javascript - React: Mapping children of a parent component - Stack Overflow

PHOTO EMBED

Fri Dec 30 2022 10:44:39 GMT+0000 (Coordinated Universal Time)

Saved by @vdgfobi #react.js

const OpaqueWrapper = ({ children }) => (        
    React.Children.map(children, child => (
       <Wrapper>
           {React.cloneElement(child, {style: {...child.props.style, opacity: 0.5}})}
       </Wrapper>
    )))
);
content_copyCOPY

https://stackoverflow.com/questions/49496906/react-mapping-children-of-a-parent-component