add props to jsx element
function AddExtraProps(Component, extraProps) {
return <Component.type {...Component.props} {...extraProps} />;
}
4.29
7
var clonedElementWithMoreProps = React.cloneElement(
this.mainContent,
{ anotherMessage: "nice to meet ya!" }
);
// now render the new cloned element? //Deep Copy
Thank you!
7
0
Are there any code examples left?
New code examples in category Javascript