I'm trying to figure out how to clone an existing element with additional props.
For reference:
this.mainContent = <Hello message="Hello world!" />
I attempted to do something like
React.createElement(this.mainContent, Object.assign({},
this.mainContent.props, { anotherMessage: "nice to meet ya!" }));
but it's not working.
How would I accomplish this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…