Skip to content

Commit ea6d90e

Browse files
Changed the documentation for React.Children.only to make its implementation simpler to understand.
Fixes reactjs#87
1 parent a201113 commit ea6d90e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

content/docs/reference-react.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ Returns the total number of components in `children`, equal to the number of tim
176176
React.Children.only(children)
177177
```
178178

179-
Returns the only child in `children`. Throws otherwise.
179+
Verifies that `children` has only one child (a React element) and returns it. Otherwise this method throws.
180+
181+
> Note:
182+
>
183+
>`React.Children.only()` does not accept the return value of [`React.Children.map()`](#reactchildrenmap) because it is an array rather than a React element.
180184

181185
#### `React.Children.toArray`
182186

0 commit comments

Comments
 (0)