mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
Add Sync Your react-router State With Redux as a react til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||
|
||||
_665 TILs and counting..._
|
||||
_666 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -471,6 +471,7 @@ _665 TILs and counting..._
|
||||
- [Quickly Search For A Component With React DevTools](react/quickly-search-for-a-component-with-react-devtools.md)
|
||||
- [Read Only Input Elements](react/read-only-input-elements.md)
|
||||
- [Rendering Multiple Nodes With Fragments](react/rendering-multiple-nodes-with-fragments.md)
|
||||
- [Sync Your react-router State With Redux](react/sync-your-react-router-state-with-redux.md)
|
||||
- [Test Files In create-react-app](react/test-files-in-create-react-app.md)
|
||||
- [Upgrading To The Latest React In CodeSandbox](react/upgrading-to-the-latest-react-in-codesandbox.md)
|
||||
- [Use A Ref To Autofocus An Input](react/use-a-ref-to-autofocus-an-input.md)
|
||||
|
||||
14
react/sync-your-react-router-state-with-redux.md
Normal file
14
react/sync-your-react-router-state-with-redux.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Sync Your react-router State With Redux
|
||||
|
||||
If you are building a React app that uses both `redux` and `react-router`,
|
||||
you'll find that you are managing app state in two places. Most of your app
|
||||
state is in `redux`. The router-specific state is component-state in the
|
||||
`Router`.
|
||||
|
||||
You can unify it all in `redux` with
|
||||
[`react-router-redux`](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux).
|
||||
|
||||
You'll need to apply some middleware, combine `routerReducer` with the rest
|
||||
of your reducers, and then swap out your `BrowserRouter` with a
|
||||
`ConnectedRouter`. You can read about the details
|
||||
[here](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux).
|
||||
Reference in New Issue
Block a user