在極少數應用場景中,一個組件可能想改變另一個它不擁有的組件的props(就像改變一個組件的`className`,這個組件又作為`this.props.children`傳入)。其它的時候,可能想生成傳進來的一個組件的多個拷貝。`cloneWithProps()`使其成為可能。
### ReactComponent React.addons.cloneWithProps(ReactComponent component, object? extraProps)
做一個`component`的淺復制,合并`extraProps`提供的每一個props。`className`和`style`props將會被智能合并。
> 注意:
>
> `cloneWithProps`并不傳遞`key`到克隆的組件中。如果你希望保留key,將其添加到`extraProps`對象:?`js var clonedComponent = cloneWithProps(originalComponent, { key : originalComponent.key });?``ref`也一樣不會保留。