Skip to content

Redundant useEffect Dependency in Header Component #8

Description

@Amansingh0807

The Header component has redundant useEffect blocks that both fetch userInfo from localStorage and dispatch the setUserInfo action. This results in multiple dispatches of setUserInfo whenever the auth state changes, potentially causing unintended updates to the auth state.

Solution:
Remove the useEffect that has auth as a dependency, keeping only the one that runs on the initial mount to load userInfo from localStorage.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions