connected-react-router#connectRouter TypeScript Examples

The following examples show how to use connected-react-router#connectRouter. 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: router.tsx    From reactant with MIT License 7 votes vote down vote up
beforeCombineRootReducers(reducers: ReducersMapObject): ReducersMapObject {
    if (!this.autoCreateHistory) return reducers;
    if (Object.prototype.hasOwnProperty.call(reducers, this.stateKey)) {
      throw new Error(
        `The identifier '${this.stateKey}' has a duplicate name, please reset the option 'stateKey' of 'ReactantRouter' module.`
      );
    }
    return Object.assign(reducers, {
      [this.stateKey]: connectRouter(this.history),
    });
  }
Example #2
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 #3
Source File: index.ts    From multisig-react with MIT License 6 votes vote down vote up
reducers = combineReducers({
  router: connectRouter(history),
  [PROVIDER_REDUCER_ID]: provider,
  [SAFE_REDUCER_ID]: safe,
  [NFT_ASSETS_REDUCER_ID]: nftAssetReducer,
  [NFT_TOKENS_REDUCER_ID]: nftTokensReducer,
  [TOKEN_REDUCER_ID]: tokens,
  [TRANSACTIONS_REDUCER_ID]: transactions,
  [CANCELLATION_TRANSACTIONS_REDUCER_ID]: cancellationTransactions,
  [INCOMING_TRANSACTIONS_REDUCER_ID]: incomingTransactions,
  [MODULE_TRANSACTIONS_REDUCER_ID]: moduleTransactions,
  [NOTIFICATIONS_REDUCER_ID]: notifications,
  [CURRENCY_VALUES_KEY]: currencyValues,
  [COOKIES_REDUCER_ID]: cookies,
  [ADDRESS_BOOK_REDUCER_ID]: addressBook,
  [CURRENT_SESSION_REDUCER_ID]: currentSession,
  [TRANSACTIONS]: allTransactions,
})
Example #4
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 #5
Source File: index.tsx    From nouns-monorepo with GNU General Public License v3.0 6 votes vote down vote up
createRootReducer = (history: History) =>
  combineReducers({
    router: connectRouter(history),
    account,
    application,
    auction,
    logs,
    pastAuctions,
    onDisplayAuction,
  })
Example #6
Source File: index.ts    From tezos-academy with MIT License 6 votes vote down vote up
reducers = (history: any) =>
  combineReducers({
    router: connectRouter(history),
    auth,
    loading,
    users,
    toaster,
    drawer,
    progressBar,
    serviceWorker,
  })
Example #7
Source File: rootReducer.ts    From deskreen with GNU Affero General Public License v3.0 6 votes vote down vote up
// eslint-disable-next-line import/no-cycle
// import counterReducer from './features/counter/counterSlice';

export default function createRootReducer(history: History) {
  return combineReducers({
    router: connectRouter(history),
    // counter: counterReducer,
  });
}
Example #8
Source File: index.ts    From atorch-console with MIT License 5 votes vote down vote up
createRootReducer = (history: History) =>
  combineReducers({
    router: connectRouter(history),
    atorch,
    report,
  })
Example #9
Source File: index.ts    From mops-vida-pm-watchdog with MIT License 5 votes vote down vote up
createRootReducer = (history: History) =>
  combineReducers({
    router: connectRouter(history),
    sensor,
    report,
  })
Example #10
Source File: RootReducer.ts    From msteams-meetings-template with MIT License 5 votes vote down vote up
export function createRootReducer(history: History) {
  return combineReducers({
    router: connectRouter(history),
    meeting: meetingReducer
  });
}
Example #11
Source File: store.tsx    From rewind with MIT License 5 votes vote down vote up
reducer = {
  router: connectRouter(history),
  backend: backendReducer,
  settings: settingsReducer,
  [rewindDesktopApi.reducerPath]: rewindDesktopApi.reducer,
}
Example #12
Source File: store.ts    From mamori-i-japan-admin-panel with BSD 2-Clause "Simplified" License 5 votes vote down vote up
store = createStore(
  combineReducers({
    ...reducers,
    router: connectRouter(history),
  }),
  composeEnhancers(applyMiddleware(...middlewares))
)
Example #13
Source File: reducers.ts    From tezos-link with Apache License 2.0 5 votes vote down vote up
rootReducer = (history: any) =>
  combineReducers({
    router: connectRouter(history),
    toaster,
    drawer,
    progressBar
  })
Example #14
Source File: rootReducer.ts    From memex with MIT License 5 votes vote down vote up
export default function createRootReducer(history: History) {
  return combineReducers({
    router: connectRouter(history),
    layout: layoutReducer,
    document: documentReducer,
    note: notesReducer,
  });
}
Example #15
Source File: store.ts    From rusty-chat with MIT License 5 votes vote down vote up
rootReducer = combineReducers({
    router: connectRouter(history),
    user: userReducer,
    feed: feedReducer,
})