Created
January 7, 2019 06:42
-
-
Save nhanco/3399ad3dc8862d008b19d502bf4fd5cf to your computer and use it in GitHub Desktop.
Send props color = this.props.color to all children
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
const { children } = this.props | |
const childrenWithProps = React.Children.map(children, child => | |
React.cloneElement(child,{color:this.props.color}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment