rxstore-react-router
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

RxStore React Router

This is the official React Router bindings for React RxStore Observer.

This project is currently in development.

Usage:

import { createRouterObserver, push, routerReducer } from 'rxstore-react-router'
import { createRxStore, combineReducers } from 'rxstore-observer'
import { BrowserRouter as Router } from 'react-router-dom'
import { Switch, Route } from 'react-router'
import { Path1, Path2 } from './components'
import storeReducer from './reducer'

const store = createRxStore( combineReducers({ main: storeReducer, route: routerReducer }) )

const RouterObserver = createRouterObserver(store)

const YourAwesomeApp = () => {
    return (
        <Router>
            <RouterObserver>
                <Switch>
                    <Route path="/path-1" exact={ true } component={ Path1 }/>
                    <Route path="/path-2" exact={ true } component={ Path2 }/>
                </Switch>
            </RouterObserver>
        </Router>
    )
}

store.dispatch( push('/path-2') ) // Calls history.push. Awesome!

Package Sidebar

Install

npm i rxstore-react-router

Weekly Downloads

5

Version

1.1.6

License

ISC

Unpacked Size

23.3 kB

Total Files

19

Last publish

Collaborators

  • blankart