Merge pull request #1867 from WickyNilliams/patch-1

Add note about key prop being excluded by cloneWithProps
This commit is contained in:
Paul O’Shannessy
2014-08-13 17:36:48 -07:00

View File

@@ -11,3 +11,10 @@ In rare situations a component may want to change the props of a component that
#### `ReactComponent React.addons.cloneWithProps(ReactComponent component, object? extraProps)`
Do a shallow copy of `component` and merge any props provided by `extraProps`. Props are merged in the same manner as [`transferPropsTo()`](/react/docs/component-api.html#transferpropsto), so props like `className` will be merged intelligently.
> Note:
>
> `cloneWithProps` does not transfer the `key` prop to the cloned component. If you wish to preserve the key, add it to the `extraProps` object:
> ```js
> var clonedComponent = cloneWithProps(originalComponent, { key : originalComponent.props.key });
> ```