clone docs
petehunt committed
Feb 18, 2014 at 23:26 UTC
30faba394d79e19387146417cf28e4ee966946f9
3 files changed
+17
-1
docs/_data/nav_docs.yml
+2
@@ -47,6 +47,8 @@
47
title: Class Name Manipulation
48
- id: test-utils
49
title: Test Utilities
50
+ - id: clone-with-props
51
+ title: Cloning Components
52
- id: examples
53
title: Examples
54
- title: Reference
docs/docs/09.4-test-utils.md
+1
-1
@@ -4,7 +4,7 @@ title: Test Utilities
4
layout: docs
5
permalink: test-utils.html
6
prev: class-name-manipulation.html
7
-next: examples.html
7
+next: clone-with-props.html
8
---
9
10
`React.addons.TestUtils` makes it easy to test React components in the testing framework of your choice (we use [Jasmine](http://pivotal.github.io/jasmine/) with [jsdom](https://github.com/tmpvar/jsdom)).
docs/docs/09.5-clone-with-props.md
new
+14
@@ -0,0 +1,14 @@
1
+---
2
+id: clone-with-props
3
+title: Cloning Components
4
+layout: docs
5
+permalink: clone-with-props.html
6
+prev: test-utils.html
7
+next: examples.html
8
+---
9
+
10
+In rare situations a component may want to change the props of a component that it doesn't own (like changing the `className` of a component passed as `this.props.children`). Other times it may want to make multiple copies of a component passed to it. `cloneWithProps()` makes this possible.
11
+
12
+#### `ReactComponent React.addons.cloneWithProps(ReactComponent component, object? extraProps)`
13
+
14
+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.