react add class to children code example
Example: react add class to each children
const StyleInjector = ({ children }) => {
const StyledChildren = () =>
React.Children.map(children, child =>
React.cloneElement(child, {
className: `${child.props.className} ${PUT_YOUR_CLASS_HERE}`
})
);
return <StyledChildren />;
};