You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 26, 2018. It is now read-only.
The idea behind redux-simple-router is to keep history in sync between redux and the router history.
In my opinion, it's preferable for redux to be the source of truth for the router, rather than history to be the source of truth that is shared by the router and redux.
My idea is this:
Let the browser history tell redux what to do (e.g. back, forward, initial page load, etc.)
Let links, buttons, etc. tell redux what to do (i.e. not tell the router what to do).
1 Give react-router a memoryHistory object instead of the real browserHistory object.
2. The only thing that writes to memoryHistory is a redux store subscriber.
3. wrap the memoryHistory object we give to react-router so that we can intercept push calls so that they call a changeLocation action creator rather than writing to memoryHistory directly.
4. Separately, listen to a real browserHistory object, and call the changeLocation action creator from the history listener.
Also, I'm using a slightly different approach for preventing cycles, so I believe the locationsAreEqual complexity is unnecessary.
I've probably missed some edge cases (or perhaps I've missed something larger than that?), but I wanted to share the basic idea and get some feedback.