I\'m trying to figure out how to clone an existing element with additional props.
For reference:
this.mainContent =
React.createElement()
takes either a string or a React class type as its first parameter, so that won't work if you're trying to clone an element.
Of course, there's React.cloneElement() instead, which does a deep copy of another React element and can optionally provide new props.
var foo = React.cloneElement(this.mainContent, {anotherMessage: "nice to meet ya!"});
Should work.