Skip to content

scienceai/react-router-redux-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-router-redux-sync

Sync params and location from react-router (v3) to a redux store.

Usage

import {
  SyncRouting,
  locationReducer,
  paramsReducer
} from 'react-router-redux-sync';
import React from 'React';
import { render } from 'react-dom';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { Router, Route, browserHistory } from 'react-router';

import App from './App';
import reducers from './reducers';

const store = createStore(
  combineReducers(
    Object.assign(
      { location: locationReducer, params: paramsReducer },
      reducers
    )
  )
);

render(
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={SyncRouting(App)}>
        // Your store will now have have access to synced `location` and `params`
        // ...
      </Route>
    </Router>
  </Provider>,
  document.body
);

About

Sync params and location from react-router to a redux store

Resources

License

Stars

Watchers

Forks

Packages

No packages published