could you please explain me from where i am getting access to state variable that you are accepting as a parameter . But When you are calling this stateToLocalStorage function you are not passing any kind of arguments into it . So how this is persisting all the state data
could you please explain me from where i am getting access to state variable that you are accepting as a parameter . But When you are calling this stateToLocalStorage function you are not passing any kind of arguments into it . So how this is persisting all the state data
It's a redux store. The state is stored in the store and the store is stored in local storage.
If you don't need redux I've written an article about just using storage too.
React: Custom hook for accessing storage
Andrew Bone ・ Apr 21 '21 ・ 8 min read