In our project, I was need to sync a piece of information between localStorage
and the Redux state. Actually I subscribed to changes in a localStorage
and in Redux, and if change happens in localStorage
I update the state, and vice versa.
Right now I've created a redux enhancer for that. My coworker, however, claims that it isn't enhancing store functionality, and recommends to use a component, a content-provider or a fragment for that.
As doing it inside Redux' reducers is not recommended, as the reducers should be pure functions, where am I expected to put this sort of side effects?
Component
,Content-Provider
orFragments
. It should sync only JWT token. I must admit, that I relatively new in a react, only one month. In Vue, I would has done this functionality in anAction
. But according to Dan Abramov, Redux' Reducer must be pure functions, so it should be done in other place. stackoverflow.com/questions/35305661/…