DEV Community

Discussion on: How to persist data to localStorage in React with hooks.

Collapse
 
gautham495 profile image
Gautham Vijayan

No farid, I can even share my source code, It works absolutely fine.

Collapse
 
muhfaridzia profile image
Muhammad Farid Zia

Yaps, your code work, but your second useEffect will run every render because you omit deps, that's the problem.

reactjs.org/docs/hooks-effect.html...

Thread Thread
 
gautham495 profile image
Gautham Vijayan

Naa bro! It works, You can go and check my project's console