### 当需要扩展子组件的功能或属性的时候,可以利用React.cloneElement来创建具有扩展数据或功能的新组件(可以用来修改子组件属性值,复制子组件,添加子组件)。
Clone and return a new React element using element
as the starting point. The resulting element will have the original element’s props with the new props merged in shallowly. New children will replace existing children. key
and ref
from the original element will be preserved.
说明: 该方法以 element 作为起点,克隆并返回一个新的 React 元素。所产生的元素将具有原始元素的props ,新的 props 为浅层合并。 新的子元素将取代现有的子元素, key 和 ref 将被保留。
React.cloneElement(
element,
[pr