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
Redux advocates the use of a single store with a single state. However, with react-router you get multiple pages each having their own top-level root component.
How should one go about wiring up redux with a react-router app that has multiple pages? React-router 1.0 no longer lets you pass props to the routes so making the router the top level component that contains the state for all the pages is no longer possible nor is it feasible.
A simple example would be appreciated.
The text was updated successfully, but these errors were encountered:
examples/real-world uses React Router through Redux Router.
This is the approach we recommend.
See also #637 for discussion.
React-router 1.0 no longer lets you pass props to the routes so making the router the top level component that contains the state for all the pages is no longer possible nor is it feasible.
Having just one connected root component is overkill anyway. Connecting route handlers is perfectly reasonable from performance and other standpoints. You still have one store. Please see #419 for discussion.
@gaearon, I am new with redux, but I am assuming by "connected" you mean doing something like store.subscribe(...) inside of the component.
When I subscribe inside of the top level component that renders that particular page, do I simply set the state of that component with a subtree of the store state?
Redux advocates the use of a single store with a single state. However, with react-router you get multiple pages each having their own top-level root component.
How should one go about wiring up redux with a react-router app that has multiple pages? React-router 1.0 no longer lets you pass props to the routes so making the router the top level component that contains the state for all the pages is no longer possible nor is it feasible.
A simple example would be appreciated.
The text was updated successfully, but these errors were encountered: