Skip to content

Calling callback in the useEffect itself is wrong #1

Open
@SalehDehqanpour

Description

@SalehDehqanpour

if (hasChanged) cb(); // if dependencies has changed call the callback function.

According to react, the effect is run after the render and commit finishes but this code is calling cb in the body of useEffect itself.

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