Skip to content

Conversation

blairwilcox
Copy link

Clarifies the callback parameters for React.Children.map() and React.Children.forEach() by noting that they can also contain an optional index parameter as a second argument.

I'm not sure if the way I formatted the parameters in the function is correct. I noticed that before, thisArg was wrapped in brackets. Was that to signify it was optional? Feel free to correct me on that.

Preview of the change:
image

Clarifies the callback parameters for React.Children.map()
and React.Children.forEach() by noting that they can also
contain an optional `index` parameter as a second
argument.
@reactjs-bot
Copy link

Deploy preview for reactjs failed.

Built with commit 3a94eb0

https://app.netlify.com/sites/reactjs/deploys/5a891d70fd0efa595665e259

@@ -154,15 +154,15 @@ Verifies the object is a React element. Returns `true` or `false`.
#### `React.Children.map`

```javascript
React.Children.map(children, function[(thisArg)])
React.Children.map(children, function(thisArg, [index]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comma for optional parameters should be within the square bracket -

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

@facebook-github-bot facebook-github-bot deleted the branch reactjs:master July 6, 2021 18:08
BetterZxx pushed a commit to BetterZxx/react.dev that referenced this pull request Mar 21, 2023
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants