更新时间:2023-12-01 08:43:04
您需要使用 React.cloneElement
例如:
You need to clone the element and add the additional props using React.cloneElement
e.g:
var clonedElementWithMoreProps = React.cloneElement(
this.mainContent,
{ anotherMessage: "nice to meet ya!" }
);
// now render the new cloned element?