我想弄清楚如何克隆现有的元素与额外的道具。反应:添加道具到现有的组件
参考:
this.mainContent = <Hello message="Hello world!" />
我试图做类似
React.createElement(this.mainContent, Object.assign({},
this.mainContent.props, { anotherMessage: "nice to meet ya!" }));
,但它不工作。
我该如何做到这一点?
https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement – azium