Skip to content

[hooks] useEffectAfterMount does not in React 18's strict mode in development environment #25

@ArtemGolovko

Description

@ArtemGolovko

useEffectAfterMount does not in React 18's strict mode in development environment, because react first mounts component, which sets isMounted.current to true, then unmounts component and mounts again. The problem is that isMounted.current is true on second mount.

Solution - reset isMounted.current on unmount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions