How to use redux-router - 10 common examples

To help you get started, we’ve selected a few redux-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sky-uk / api-explorer / packages-legacy / apiexplorer-legacy / src / store / configureStore.prod.js View on Github external
import { createStore, compose, applyMiddleware } from 'redux'
import reducers from 'reducers'
import { reduxReactRouter } from 'redux-router'
import createHistory from 'history/lib/createBrowserHistory' // history/lib/createHashHistory
import thunk from 'redux-thunk'

const finalCreateStore = compose(
  applyMiddleware(thunk),
  reduxReactRouter({ createHistory })
)(createStore)

export default function configureStore (initialState) {
  const store = finalCreateStore(reducers, initialState)
  return store
}
github JakeGinnivan / Drone / src / app.js View on Github external
import Routes from './routes'
import createHistory from 'history/lib/createBrowserHistory'
import drone from './reducers/drone'

import { createStore, compose, combineReducers } from 'redux'
import { Provider } from 'react-redux'

// Grab the state from a global injected into server-generated HTML
const initialState = window.__INITIAL_STATE__
const reducer = combineReducers({
  router: routerStateReducer,
  drone
})

let store = compose(
  reduxReactRouter({ createHistory }) //, devTools()
)(createStore)(reducer, initialState)

ReactDOM.render(
  
    {Routes}
  ,
  document.getElementById('container')
)
github nus-mtp / cubist / src / webapp / components / _containers / AuthorisationContainer.js View on Github external
componentWillMount() {
    const { dispatch, user } = this.props;
    if (!user) {
      if (process.env.BROWSER) {
        dispatch(pushState(null, '/'));
      } else {
        dispatch(ServerActions.redirect('/'));
      }
    }
  }
github nus-mtp / cubist / src / webapp / components / _containers / RegisterContainer.js View on Github external
componentWillMount() {
    const { dispatch, ownUserId } = this.props;
    if (ownUserId) {
      if (process.env.BROWSER) {
        dispatch(pushState(null, '/'));
      } else {
        dispatch(ServerActions.redirect('/'));
      }
    }
  }
github nus-mtp / cubist / src / webapp / components / _containers / ResetPasswordContainer.js View on Github external
componentWillMount() {
    const { dispatch, ownUserId } = this.props;
    if (ownUserId) {
      if (process.env.BROWSER) {
        dispatch(pushState(null, '/'));
      } else {
        dispatch(ServerActions.redirect('/'));
      }
    }
  }
github nus-mtp / cubist / src / webapp / components / _containers / LoginContainer.js View on Github external
componentWillMount() {
    const { dispatch, ownUserId } = this.props;
    if (ownUserId) {
      if (process.env.BROWSER) {
        dispatch(pushState(null, '/'));
      } else {
        dispatch(ServerActions.redirect('/'));
      }
    }
  }
github nus-mtp / cubist / src / webapp / components / _containers / LoginContainer.js View on Github external
componentWillReceiveProps(nextProps) {
    const { dispatch } = this.props;
    if (nextProps.success && nextProps.ownUserId) {
      dispatch(pushState(null, '/'));
    }
  }
github nextzen / nextzen.js / app / store / configureStore.prod.js View on Github external
import { createStore, applyMiddleware,compose } from 'redux'
import { reduxReactRouter } from 'redux-router'
import routes from '../config/routes'
import thunk from 'redux-thunk'
import reducer from '../reducers/index'
import createHistory from 'history/lib/createBrowserHistory'
import createLogger from 'redux-logger'

const finalCreateStore = compose(
  applyMiddleware(thunk),
  reduxReactRouter({routes, createHistory})
)(createStore);

export default function configureStore(initialState) {
  return finalCreateStore(reducer, initialState)
}
github weslleyaraujo / pokedux / src / store / configureStore.prod.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import { reduxReactRouter } from 'redux-router';
import { createHistory } from 'history';
import thunk from 'redux-thunk';

import rootReducer from 'reducers/rootReducer';

const createStoreWithMiddleware = compose(
  applyMiddleware(thunk),
  reduxReactRouter({ createHistory })
)(createStore);

export default function configureStore(initialState) {
  return createStoreWithMiddleware(rootReducer, initialState);
}
github lawrence0819 / neptune-front / src / stores / store.ts View on Github external
const reducer = combineReducers({
  router: routerStateReducer,
  machine,
  driver,
  docker,
  container,
  image,
  registry,
  error,
  httpRequest
});

export default compose(
  applyMiddleware(thunkMiddleware, logger),
  reduxReactRouter({ createHistory })
)(createStore)(reducer);

redux-router

Redux bindings for React Router — keep your router state inside your Redux Store.

MIT
Latest version published 8 years ago

Package Health Score

57 / 100
Full package analysis