Skip to content
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

Update inaccurate mapChildren comment #18931

Merged
merged 1 commit into from
May 15, 2020
Merged

Update inaccurate mapChildren comment #18931

merged 1 commit into from
May 15, 2020

Conversation

rickyvetter
Copy link
Contributor

The function you provide will only be passed a child and an index. It will not be passed a key. This is confirmed in the source, the Flow types, and the jsdoc comments.

Summary

I was actually looking for a child map api that would expose keys and noticed this comment. It gave me the wrong impression and took a few minutes to re-affirm my understanding of React.Children and how it works. Removing this inaccuracy to hopefully prevent a similar misunderstanding in the future.

Test Plan

I ran absolutely no tests. This is a non-jsdoc comment-only change.

The function you provide will only be passed a child and an index. It will not be passed a key. This is confirmed in the source, the Flow types, and the jsdoc comments.
@sizebot
Copy link

sizebot commented May 15, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against bbda3d9

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bbda3d9:

Sandbox Source
goofy-smoke-5kdkf Configuration

@sizebot
Copy link

sizebot commented May 15, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against bbda3d9

@gaearon gaearon merged commit 121af31 into master May 15, 2020
@gaearon
Copy link
Collaborator

gaearon commented May 15, 2020

Note it should care of merging with the old key automatically.

@rickyvetter
Copy link
Contributor Author

Thanks for the note. Reading through the source really changed how I view the "keyed-ness" of an element. I'm glad I did.

@kassens kassens deleted the map-children-comment branch November 29, 2022 22:21
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