redux-cube-with-router
v1.2.0
Published
redux-cube's pluggable module for react-router v4+
Downloads
21
Maintainers
Readme
redux-cube-with-router
redux-cube's pluggable module for react-router v4+
npm install --save redux-cube-with-router
Get Started
// xxx/App.jsx
import { createApp } from 'redux-cube';
import withRouter from 'redux-cube-with-router';
import { Route } from 'react-router-dom';
@createApp(withRouter({
reducers: {
// ...
},
// optional
// https://github.com/ReactTraining/history#usage
supportHtml5History: false,
// optional
// https://github.com/ReactTraining/react-router/blob/master/packages/react-router-redux/modules/ConnectedRouter.js#L8
routerConfig: {},
// ...
})))
class SubApp extends PureComponent {
render() {
return (
<Route path="/" component={Home}>
<Route path="foo" component={Foo}/>
<Route path="bar" component={Bar}/>
</Route>
);
}
}