I'm wondering how can I inject router's redux state other than router key when I use connectRouter().
In case of _react-router-redux_, this can be done by adding combining reducer manually.
import { routerReducer } from "react-router-redux";
import { combineReducers } from "redux";
import fooReducer from "./foo"
export default combineReducers({
foo: fooReducer,
someRouterStateKeyOtherThanRouter: routerReducer,
});
As far as I can see it is not possible because the "router" key is hard-coded and is used to find the data at the root of the store, see this line of code.
So the store shape should always look like this:
{
foo: '',
router: {
location: {
pathname: '/',
search: '',
hash: ''
},
action: 'POP'
}
}
That would be a nice to have feature.
@supasate it would be great to have an export with the router state key.
v5.0.0 supports this. (Beware of the breaking change. Please see the release note https://github.com/supasate/connected-react-router/releases/tag/v5.0.0)
Most helpful comment
v5.0.0 supports this. (Beware of the breaking change. Please see the release note https://github.com/supasate/connected-react-router/releases/tag/v5.0.0)