0.0.14 • Published 6 years ago

react-redux-router v0.0.14

Weekly downloads
411
License
ISC
Repository
github
Last release
6 years ago

react-redux-router

An incredibly simple and easy to use router for react redux apps. All that is required is a routes config object to be set, then import the Router component and routerReducer and pass the store and routes to the Router component.

Setup routes

import React from 'react'
import Home from './components/Home'
import About from './components/About'

const Routes = [
    { path: '/', component: <Home /> },
    { path: '/about', component: <About /> }
  ];

export default Routes

Basic setup (examples/counter)

import React from 'react'
import { Provider } from 'react-redux'
import ReactDOM from 'react-dom'
import { createStore, combineReducers } from 'redux'
import counter from './reducers'
import { Router, routerReducer } from '../../../'
import Routes from './routes'

const store = createStore(
  combineReducers({
    counter, 
    router: routerReducer
}))
const rootEl = document.getElementById('root')

const render = () => ReactDOM.render(
  <Provider store={store}>
    <Router store={store} routes={Routes} />
  </Provider>,
  rootEl
)

render()
store.subscribe(render)
0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.7

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago