Created
February 25, 2020 07:59
-
-
Save devethan/d922742685bd708954c612631fa573e3 to your computer and use it in GitHub Desktop.
How to use React.Children
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.Children.map(children, (child: ReactElement, index) => { | |
const { props } = child; | |
return React.cloneElement(child, { | |
...props, | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment