Integrating with redux router
See original GitHub issueFirst of all thanks for putting this together, I really like the sagas idea. I have a question and don’t know if this is the best place but here it goes anyway.
I’m trying to integrate with redux-router, the idea is to be able to take
redux-router actions and put
a new action if necessary.
import { pushState } from 'redux-router'
import ROUTER_DID_CHANGE from 'redux-router/lib/constants'
import * as actions from '../actionCreators'
// sagas/index.js
export function* watchNavigate() {
let action = null
while(action = yield take(ROUTER_DID_CHANGE)) {
yield put(actions.show(action.payload.pathname)) //navigate
}
}
//...
The main idea is to be able to react to a route change event like hitting the browser back button.
Is there any way to do it? I tried and all my actions can be take
en but none of the redux-router ones, I’m certainly missing something.
Thanks in advance.
Issue Analytics
- State:
- Created 8 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Deep Redux Integration - React Router v5
We want to make the integration of React Router and Redux as seamless as possible for ... Synchronize the routing data with, and...
Read more >Using React Router with Redux - Pluralsight
You can use the connected-react-router library (formerly known as react-router-redux ). Their Github Repo details the steps for the integration.
Read more >React Router with Redux: Understanding navigation state
Integrating Connected React Router · 1. Create a history object. Technically, there's a DOM history object for manipulating the browser's history ...
Read more >With Redux - Router5
Note: if a Redux integration exists, you might not want to couple your router state to Redux. ... The plugin simply syncs the...
Read more >React With Redux, React Router And API Integration - YouTube
In this video I wanted to show you guys how to put redux, and react router together along side a simple api to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cherta thanks! This is definitely cool. I was thinking of using saga in a slightly different way (rewriting the url on invalid selections) but its helpful to see your approach here!
If you use Redux-simple-router you actually can replay history (except currently for POP operations because its already been popped off).
I agree React-Router alone can kind of feel that way, however efforts like redux-router and redux-simple-router are trying to be more “redux-pure” and have the store drive the url bar