Skip to content

Add a note that useEffect is not guaranteed to run after paint #4107

Description

@thoughtspile

useEffect docs suggest the effect always runs after paint, which is apparently not guaranteed. For example, when useLayoutEffect from the same render triggers an update, the effect must be flushed before that update, which is before paint (I wrote a post detailing this behavior). Folks in react/react#20863 discuss similar pitfalls.

Could we clarify the guarantees in the docs? I'd be glad to submit a PR if you confirm my understanding of the behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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