update docs for React.Children
petehunt committed
Feb 3, 2014 at 23:28 UTC
9e1c6950b1c216e504725ed2d7ae46e93d69d1df
1 file changed
+29
docs/docs/ref-01-top-level-api.md
+29
@@ -11,6 +11,35 @@ next: component-api.html
11
`React` is the entry point to the React framework. If you're using one of the prebuilt packages it's available as a global; if you're using CommonJS modules you can `require()` it.
12
13
14
+### React.Children
15
+
16
+`React.Children` provides utilities for dealing with the `this.props.children` opaque data structure.
17
+
18
+#### React.Children.map
19
+
20
+```javascript
21
+array React.Children.map(object children, function fn [, object context])
22
+```
23
+
24
+Invoke `fn` on every immediate child contained within `children` with `this` set to `context`. If `children` is a nested object or array it will be traversed: `fn` will never be passed the container objects.
25
+
26
+#### React.Children.forEach
27
+
28
+```javascript
29
+React.Children.forEach(object children, function fn [, object context])
30
+```
31
+
32
+Like `React.Children.map()` but does not return an array.
33
+
34
+#### React.children.only()
35
+
36
+```javascript
37
+object React.Children.only(object children)
38
+```
39
+
40
+Return the only child in `children`. If `children` is a nested object or array it will be traversed.
41
+
42
+
43
### React.DOM
44
45
`React.DOM` provides all of the standard HTML tags needed to build a React app. You generally don't use it directly; instead, just include it as part of the `/** @jsx React.DOM */` docblock.