Created
March 23, 2021 23:02
-
-
Save psenger/c327442595b7c9623378327f5cf34d67 to your computer and use it in GitHub Desktop.
[How to Wrap React Children] #ReactJs
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
| const OpaqueWrapper = ({ children }) => ( | |
| children && ( | |
| <Wrapper> | |
| {React.Children.map(children, child => ( | |
| React.cloneElement(child, {style: {...child.props.style, opacity: 0.5}}) | |
| ))} | |
| </Wrapper> | |
| ) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment