redux-cube-with-router-legacy
v1.0.10
Published
redux-cube's pluggable module for react-router v3
Downloads
6
Maintainers
Readme
redux-cube-with-router-legacy
redux-cube's pluggable module for react-router's legacy version (< 4) and react-router-redux v4
npm install --save redux-cube-with-router-legacy
For react-router v4+, use redux-cube-with-router
Get Started
// xxx/App.jsx
import { createApp } from 'redux-cube';
import withRouter from 'redux-cube-with-router-legacy';
@createApp(withRouter({
reducers: {
// ...
},
// optional
disableHashRouter: false,
// optional
// https://github.com/reactjs/react-router-redux#history--synchistorywithstorehistory-store-options
routerHistoryConfig: {
// ...
},
// ...
})))
class SubApp extends PureComponent {
render() {
const {
routerHistoryWithStore,
} = this.props;
return (
<Router history={routerHistoryWithStore}>
<Route path="/" component={Home}>
<Route path="foo" component={Foo}/>
<Route path="bar" component={Bar}/>
</Route>
</Router>
);
}
}