Quantcast
Channel: Projectmw Blog
Viewing all articles
Browse latest Browse all 75

React: Cloning elements with React.cloneElement()

$
0
0
Use this to copy elements and give them different props or add new ones. We have a Button which accepts the props textColor and backgroundColor. Then we have ButtonContainer which clones it’s children (in this case Button) but we can give it new props to create variations.

Viewing all articles
Browse latest Browse all 75

Trending Articles