How to access current location in reducer (redux-router)?
问题 How would i get the current path and query of the current location with redux-router in reducer. I am able to get the pathname easily inside the component with mapStateToProps, but i want to access the current path in reducer. I am using redux-router 1.0.0-beta7, react-router 1.0.3. 回答1: 1 .way - pass pathname with particular action through redux-thunk and getState() const someAction = data =>(dispatch,getState)=>{ dispatch({ type:'SOME_ACTION', pathname:getState().router.pathname }) } 2 .way