Skip to content

docs: fix self-referential JSDoc for forEachContext param#36987

Open
KangaZero wants to merge 1 commit into
react:mainfrom
KangaZero:docs/fix-foreach-context-jsdoc
Open

docs: fix self-referential JSDoc for forEachContext param#36987
KangaZero wants to merge 1 commit into
react:mainfrom
KangaZero:docs/fix-foreach-context-jsdoc

Conversation

@KangaZero

Copy link
Copy Markdown

Summary

The JSDoc description for the forEachContext parameter in forEachChildren is self-referential:

```js

  • @param {*} forEachContext Context for forEachContext.
    ```

The description names the parameter in its own definition, which is meaningless. forEachContext is the execution context (this) passed to forEachFunc when it is called. The sibling mapChildren function (line 363) shows the correct pattern:

```js

  • @param {*} context Context for mapFunction.
    ```

How did you test this change?

Documentation-only change to a JSDoc comment — no runtime behavior is affected, no tests needed. Verified by:

  1. Comparing with the sibling mapChildren function's @param {*} context Context for mapFunction. description, which uses the same convention (naming the callback the context belongs to, not the parameter itself).
  2. Confirming the parameter's purpose: forEachContext is passed as the this value in forEachFunc.apply(this, arguments) (line 424), so "Context for forEachFunc" is factually correct.

@meta-cla

meta-cla Bot commented Jul 10, 2026

Copy link
Copy Markdown

Hi @KangaZero!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jul 10, 2026

@daltino daltino left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR fixes a small but notable typo in the JSDoc for the forEachContext parameter by correctly referencing it as the context for forEachFunc. The change improves the documentation clarity, aligning with React's commitment to precise and helpful comments.

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.

2 participants