mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 12:13:11 +00:00
Merge pull request #118 from renatoselenica/children-only-documentation
Improved the documentation for React.Children.only
This commit is contained in:
@@ -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`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user