How to use react-router-redux - 10 common examples

To help you get started, we’ve selected a few react-router-redux 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 samuelmaddock / metastream / packages / metastream-app / src / store / configureStore.prod.ts View on Github external
function configureStore(opts: ConfigureStoreOptions) {
  const thunkMiddleware = thunk.withExtraArgument(opts.extra)

  // Persist Middleware
  const persistedReducer = persistReducer(persistConfig, rootReducer)

  const router = routerMiddleware(history)
  const enhancer = applyMiddleware(thunkMiddleware, ...appMiddleware, router)

  const store = createStore(persistedReducer, opts.initialState || {}, enhancer)
  const persistor = persistStore(store, undefined, opts.persistCallback)

  return { store, persistor }
}
github owtf / owtf / owtf / webapp / src / store / configureStore.prod.js View on Github external
export default function configureStore(initialState, history) {
    // Add so dispatched route actions to the history
    const reduxRouterMiddleware = routerMiddleware(history);

    const middleware = applyMiddleware(thunk, reduxRouterMiddleware);

    return createStore(rootReducer, initialState, middleware);
}
github shinima / battle-city / app / components / GameoverScene.tsx View on Github external
componentDidMount() {
    document.addEventListener('keydown', this.onKeyDown)
    const { game, dispatch } = this.props
    if (game.status === 'idle') {
      dispatch(replace('/'))
    }
    // 这里不考虑这种情况:玩家在游戏过程中手动在地址栏中输入了 /gameover
  }
github quiltdata / quilt / catalog / app / containers / OAuth2 / index.js View on Github external
componentWillMount() {
    const { dispatch } = this.props;
    const { query } = this.props.location;
    // eslint-disable-next-line object-curly-newline, camelcase
    const { refresh_token, access_token, expires_at, next = '/' } = query;
    const tokens = {
      refresh_token,
      access_token,
      expires_at: expires_at ? parseFloat(expires_at, 10) : Infinity, // eslint-disable-line camelcase
    };
    dispatch(storeTokens(tokens));
    dispatch(getAuth(tokens));
    dispatch(replace(next));
  }
github Soluto / tweek / services / editor / src / store / ducks / selectedKey.js View on Github external
continueGuard(shouldShowConfirmationScreen, confirmAddKeyAlert, (dispatch) => {
    // update the state to empty key in order to skip on leave hook
    dispatch({ type: KEY_OPENED, payload: createBlankJPadKey() });
    // navigate and set defaults
    dispatch(push('/keys/_blank'));
    dispatch(changeKeyValueType('string'));

    const validation = { isValid: false, hint: '', isShowingHint: false };
    setImmediate(() => dispatch(updateKeyPath(keyPath, validation)));
  });
github kkav004 / react-native-redux-real-world / webapp / index.js View on Github external
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import Root from './containers/Root'
import configureStore from './store/configureStore'

const store = configureStore()
const history = syncHistoryWithStore(browserHistory, store)

render(
  ,
  document.getElementById('root')
)
github zhanglongde / 1stMickle / 05-05-react / 05-redux / redux-examples / real-world / src / index.js View on Github external
import React from 'react'
import { render } from 'react-dom'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import Root from './containers/Root'
import configureStore from './store/configureStore'

const store = configureStore()
const history = syncHistoryWithStore(browserHistory, store)

render(
  ,
  document.getElementById('root')
)
github reduxify / seedux / lib / redux / examples / real-world / src / index.js View on Github external
import React from 'react'
import { render } from 'react-dom'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import Root from './containers/Root'
import configureStore from './store/configureStore'

const store = configureStore()
const history = syncHistoryWithStore(browserHistory, store)

render(
  ,
  document.getElementById('root')
)
github cn007b / my / ed / js.reactjs / examples / reduxRealWorld / src / index.js View on Github external
import React from 'react'
import { render } from 'react-dom'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'

import Root from './containers/Root'
import configureStore from './store/configureStore'

const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);
render(
  ,
  document.getElementById('root')
);

react-router-redux

Ruthlessly simple bindings to keep react-router and redux in sync

MIT
Latest version published 7 years ago

Package Health Score

58 / 100
Full package analysis