Last active
October 14, 2020 01:18
-
-
Save reireynoso/16801671fc1c7ca63b2ec8f8bfbdc674 to your computer and use it in GitHub Desktop.
Another component forward ref sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
const AnotherComponent = React.forwardRef((props, ref) => { | |
return ( | |
<h1>Another Component</h1> | |
<input type="text" ref={ref} /> | |
) | |
}) | |
export default AnotherComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@reireynoso The content inside return statement is invalid jsx. You need to wrap the above two children in a fragment or a div like so: