Skip to content

clarify when componentDidUpdate fires #1135

@mbrowne

Description

@mbrowne

Re-posting this issue from facebook/react:
facebook/react#2796

https://reactjs.org/docs/react-component.html#componentdidupdate is unclear on when it is called with regards to the render function.

The docs state that it's "Invoked immediately after updating occurs" but it is unclear what is meant with updating in this case: it can refer to either the component as a whole updating (meaning post-render), or it can refer to setState() having been processed (which might mean pre-render).

It would be good to explicitly state when this function fires in its documentation (even if somewhere else on the site this is described in text or graphic form already).

There was a PR for this that was merged at one point: facebook/react#2801

But the current website does not include this change. I believe the language from the above PR is still correct and would be helpful to people since it's more specific than what's there currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions