connected-react-router#routerMiddleware TypeScript Examples

The following examples show how to use connected-react-router#routerMiddleware. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: configureStore.ts    From atorch-console with MIT License 6 votes vote down vote up
configureStore = () =>
  createStore(
    createRootReducer(history),
    undefined,
    composeEnhancers(
      applyMiddleware(
        routerMiddleware(history), // connected-react-router
        thunk as ThunkMiddleware<RootState>, // redux-thunk
      ),
    ),
  )
Example #2
Source File: configureStore.ts    From mops-vida-pm-watchdog with MIT License 6 votes vote down vote up
configureStore = () =>
  createStore(
    createRootReducer(history),
    undefined,
    composeEnhancers(
      applyMiddleware(
        routerMiddleware(history), // connected-react-router
        thunk as ThunkMiddleware<RootState>, // redux-thunk
      ),
    ),
  )
Example #3
Source File: App.tsx    From msteams-meetings-template with MIT License 6 votes vote down vote up
store = createStore(
  createRootReducer(hist),
  compose(
    applyMiddleware(
      routerMiddleware(hist),
      createAuthMiddleware(),
      createMeetingMiddleware()
    )
  )
)
Example #4
Source File: configureStore.ts    From che-dashboard-next with Eclipse Public License 2.0 6 votes vote down vote up
export default function configureStore(history: History, initialState?: AppState): Store {
  const middleware = [
    thunk,
    routerMiddleware(history)
  ];

  const rootReducer = combineReducers({
    ...reducers,
    router: connectRouter(history)
  });

  const enhancers: any[] = [];
  const windowIfDefined = typeof window === 'undefined' ? null : window as any;
  if (windowIfDefined && windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__) {
    enhancers.push(windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__() as any);
  }

  return createStore(
    rootReducer,
    initialState,
    compose(applyMiddleware(...middleware), ...enhancers)
  );
}
Example #5
Source File: index.ts    From multisig-react with MIT License 6 votes vote down vote up
finalCreateStore = composeEnhancers(
  applyMiddleware(
    thunk,
    routerMiddleware(history),
    notificationsMiddleware,
    safeStorage,
    providerWatcher,
    addressBookMiddleware,
    currencyValuesStorageMiddleware,
  ),
)
Example #6
Source File: index.ts    From idena-pocket with MIT License 6 votes vote down vote up
store = (() => {
	const store = createStore(
		combineReducers({
			router: connectRouter(history),
			app: rootReducer(defaultState)
		}),
		compose(
			applyMiddleware(routerMiddleware(history), ...middlewares),
			...(process.env.NODE_ENV === 'development' && devtools
				? [devtools()]
				: [])
		)
	)

	if ((module as any).hot) {
		// Enable Webpack hot module replacement for reducers
		;(module as any).hot.accept('../reducer', () => {
			const nextRootReducer = require('../reducer')
			store.replaceReducer(nextRootReducer)
		})
	}

	return store
})()
Example #7
Source File: index.tsx    From nouns-monorepo with GNU General Public License v3.0 6 votes vote down vote up
export default function configureStore(preloadedState: PreloadedState<any>) {
  const store = createStore(
    createRootReducer(history), // root reducer with router state
    preloadedState,
    composeWithDevTools(
      applyMiddleware(
        routerMiddleware(history), // for dispatching history actions
        // ... other middlewares ...
      ),
    ),
  );

  return store;
}
Example #8
Source File: App.store.tsx    From tezos-academy with MIT License 6 votes vote down vote up
export function configureStore(preloadedState: any) {
  const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
    ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ trace: true, traceLimit: 25 })
    : compose

  const store: Store<State> = offline(storeOfflineConfig)(createStore)(
    reducers(history) as any,
    preloadedState,
    composeEnhancer(
      applyMiddleware(routerMiddleware(history)),
      applyMiddleware(thunk),
      applyMiddleware(reduxOfflineThunkMiddleware()),
    ),
  )

  return store
}
Example #9
Source File: configureStore.ts    From tezos-link with Apache License 2.0 6 votes vote down vote up
export function configureStore(preloadedState: any) {
  const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
  const store = createStore(
    rootReducer(history),
    preloadedState,
    composeEnhancer(applyMiddleware(routerMiddleware(history)), applyMiddleware(thunk))
  )

  return store
}
Example #10
Source File: store.ts    From rusty-chat with MIT License 6 votes vote down vote up
export default function configureStore(): any {
    const sagaMiddleware = createSagaMiddleware();
    const store = createStore(rootReducer, compose(applyMiddleware(routerMiddleware(history), sagaMiddleware)));

    sagaMiddleware.run(apiSaga);
    sagaMiddleware.run(userSaga);
    sagaMiddleware.run(feedSaga);

    return store;
}
Example #11
Source File: store.tsx    From rewind with MIT License 5 votes vote down vote up
store = configureStore({
  devTools: process.env.NODE_ENV !== "production",
  reducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(sagaMiddleware).concat(routerMiddleware(history)).concat(rewindDesktopApi.middleware),
})
Example #12
Source File: store.ts    From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License 5 votes vote down vote up
routeMiddleware = routerMiddleware(history)
Example #13
Source File: store.ts    From deskreen with GNU Affero General Public License v3.0 5 votes vote down vote up
router = routerMiddleware(history)