Changed the documentation for React.Children.only to make its implementation simpler to understand.

Fixes #87
This commit is contained in:
renatoselenica
2017-10-10 16:39:39 +02:00
parent a201113535
commit ea6d90ef32

View File

@@ -176,7 +176,11 @@ Returns the total number of components in `children`, equal to the number of tim
React.Children.only(children)
```
Returns the only child in `children`. Throws otherwise.
Verifies that `children` has only one child (a React element) and returns it. Otherwise this method throws.
> Note:
>
>`React.Children.only()` does not accept the return value of [`React.Children.map()`](#reactchildrenmap) because it is an array rather than a React element.
#### `React.Children.toArray`