Skip to content

Clarify use of map, add missing commas #3065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions content/docs/reference-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ Verifies the object is a React element. Returns `true` or `false`.

`React.Children` provides utilities for dealing with the `this.props.children` opaque data structure.

#### `React.Children.map` {#reactchildrenmap}
#### `React.Children.
` {#reactchildrenmap}

```javascript
React.Children.map(children, function[(thisArg)])
React.Children.map(children, function[, (thisArg)])
```

Invokes a function on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is an array it will be traversed and the function will be called for each child in the array. If children is `null` or `undefined`, this method will return `null` or `undefined` rather than an array.
Invokes a function on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is an array it will be traversed and the function will be called for each non-`false` child in the array. After mapping, any `null` or `undefined` children will be removed from the result. If children is `null` or `undefined`, this method will return `null` or `undefined` rather than an array.

> Note
>
Expand All @@ -237,7 +238,7 @@ Invokes a function on every immediate child contained within `children` with `th
#### `React.Children.forEach` {#reactchildrenforeach}

```javascript
React.Children.forEach(children, function[(thisArg)])
React.Children.forEach(children, function[, (thisArg)])
```

Like [`React.Children.map()`](#reactchildrenmap) but does not return an array.
Expand Down