From 5de5db12e52cf13dea24c280a5299f1dc2b7dbaa Mon Sep 17 00:00:00 2001 From: petehunt Date: Mon, 3 Feb 2014 23:28:49 -0800 Subject: [PATCH] update docs for React.Children --- docs/ref-01-top-level-api.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/ref-01-top-level-api.md b/docs/ref-01-top-level-api.md index 48f76417..8c592c50 100644 --- a/docs/ref-01-top-level-api.md +++ b/docs/ref-01-top-level-api.md @@ -11,6 +11,35 @@ next: component-api.html `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. +### React.Children + +`React.Children` provides utilities for dealing with the `this.props.children` opaque data structure. + +#### React.Children.map + +```javascript +array React.Children.map(object children, function fn [, object context]) +``` + +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. + +#### React.Children.forEach + +```javascript +React.Children.forEach(object children, function fn [, object context]) +``` + +Like `React.Children.map()` but does not return an array. + +#### React.children.only() + +```javascript +object React.Children.only(object children) +``` + +Return the only child in `children`. If `children` is a nested object or array it will be traversed. + + ### React.DOM `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.