reactjs / react-router-redux

Ruthlessly simple bindings to keep react-router and redux in sync
https://www.npmjs.com/package/react-router-redux
MIT License
7.81k stars 644 forks source link

routerActions.push not dispatching even to reducer #616

Closed monkseal closed 6 years ago

monkseal commented 6 years ago
import { routerActions } from "react-router-redux";

const mapDispatchToProps = (dispatch) => ({
  onChange: (newPath) => {
    if (!newPath) { return; }
    dispatch(routerActions.push(newPath));
  }
});

With a reducer:

const routerReducer = (state = defaultRouterState, { type, payload } = {}) => {
  if (type === LOCATION_CHANGE) {
    return { ...state, location: payload };
  }

  return state;
};

However when the action is trigger, there is no LOCATION_CHANGE (or any other action) dispatched to the reducer? Is this by design?

timdorr commented 6 years ago

This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. Thanks!