Created
March 3, 2021 08:42
-
-
Save cuonghuynh/3d16a69542a262c725d8b0fdfe54203e to your computer and use it in GitHub Desktop.
React pass custom prop to ForwardRef component
This file contains 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
export const MySection = React.forwardRef< | |
HTMLDivElement, | |
{ myAttribute: boolean } | |
>(({ myAttribute }, ref) => { | |
return ( | |
// your component | |
) | |
} | |
<MySection ref={mySectionRef} myAttribute={true} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment