question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrating with redux router

See original GitHub issue

First 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 takeen but none of the redux-router ones, I’m certainly missing something.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mjrussellcommented, Jan 19, 2016

@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!

0reactions
mjrussellcommented, Jan 21, 2016

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found