Skip to content

Redundant useEffect Dependency in Header Component #8

@Amansingh0807

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.

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