@samitouri / QOS-React-2 / commits / 319b374097

Add docs for `React.Children.toArray` in 0.14.0.

* Update the docs to change return type of `React.Children.map` from `object` to `array`.

Nick Presta committed Oct 7, 2015 at 19:12 UTC 319b37409769ee32f6a3f5a80a986298f8fd06e4
1 file changed +11 -3
docs/docs/ref-01-top-level-api.md
+11 -3
@@ -97,10 +97,10 @@ Verifies the object is a ReactElement.
97 #### React.Children.map
98
99 ```javascript
100 -object React.Children.map(object children, function fn [, object thisArg])
100 +array React.Children.map(object children, function fn [, object thisArg])
101 ```
102
103 -Invoke `fn` on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is a nested object or array it will be traversed: `fn` will never be passed the container objects. If children is `null` or `undefined` returns `null` or `undefined` rather than an empty object.
103 +Invoke `fn` on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is a nested object or array it will be traversed: `fn` will never be passed the container objects. If children is `null` or `undefined` returns `null` or `undefined` rather than an array.
104
105 #### React.Children.forEach
106
@@ -108,7 +108,7 @@ Invoke `fn` on every immediate child contained within `children` with `this` set
108 React.Children.forEach(object children, function fn [, object thisArg])
109 ```
110
111 -Like `React.Children.map()` but does not return an object.
111 +Like `React.Children.map()` but does not return an array.
112
113 #### React.Children.count
114
@@ -126,6 +126,14 @@ object React.Children.only(object children)
126
127 Return the only child in `children`. Throws otherwise.
128
129 +#### React.Children.toArray
130 +
131 +```javascript
132 +array React.Children.toArray(object children)
133 +```
134 +
135 +Return the `children` opaque data structure as a flat array with keys assigned to each child. Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice `this.props.children` before passing it down.
136 +
137 ## ReactDOM
138
139 The `react-dom` package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch to get outside of the React model if you need to. Most of your components should not need to use this module.