redux-cube-with-router-legacy

1.0.10 • Public • Published

redux-cube-with-router-legacy

< Back to Project WebCube

NPM Version

Nodei

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>
    );
  }
}

Package Sidebar

Install

npm i redux-cube-with-router-legacy

Weekly Downloads

14

Version

1.0.10

License

MIT

Unpacked Size

8.82 kB

Total Files

11

Last publish

Collaborators

  • dexteryy