Created
February 1, 2023 03:19
-
-
Save vinnymac/98f62066dc0f237a8db61926c42359d5 to your computer and use it in GitHub Desktop.
React 18 Children Prop Type
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
| // React 17 or lower | |
| type DropdownProps = { | |
| open: boolean; | |
| } | |
| // React 18 or higher | |
| type DropdownProps = { | |
| open: boolean; | |
| children?: React.ReactNode; | |
| } | |
| // Alternatively, you may use the type helper React provides | |
| type DropdownProps = React.PropsWithChildren<{ | |
| open: boolean; | |
| }> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment