connected-react-router#connectRouter JavaScript 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: configureStore.js    From HexactaLabs-NetCore_React-Initial with Apache License 2.0 6 votes vote down vote up
export default function configureStore(history, initialState) {
  const reducers = {
    form: formReducer,
    router: connectRouter(history),
    auth,
    home,
    provider,
    store
  };

  const middleware = [thunk, routerMiddleware(history)];

  const enhancers = [];
  // eslint-disable-next-line no-undef
  const isDevelopment = process.env.NODE_ENV === "development";

  if (
    isDevelopment &&
    typeof window !== "undefined" &&
    window.devToolsExtension
  ) {
    enhancers.push(window.devToolsExtension());
  }

  const rootReducer = combineReducers(reducers);

  return createStore(
    rootReducer,
    initialState,
    compose(
      applyMiddleware(...middleware),
      ...enhancers
    )
  );
}
Example #2
Source File: reducers.js    From brisque-2.0-desktop with MIT License 6 votes vote down vote up
export default function createRootReducer(history: History) {
  return combineReducers({
    router: connectRouter(history),
    user,
    tasks: arrayReducer(SET_TASKS),
    profiles: arrayReducer(SET_PROFILES),
    proxies: arrayReducer(SET_PROXIES)
  });
}
Example #3
Source File: render.js    From tunnel-tool with MIT License 6 votes vote down vote up
configureStore = ({ reducers, initialState }) => {
  const history = createHistory();

  // Allow the passed state to be garbage-collected
  //delete window.__PRELOADED_STATE__;
  const store = createStore(
    /***/
    combineReducers({ router: connectRouter(history), app: reducers }),
    initialState,
    /**/
    compose(
      applyMiddleware(routerMiddleware(history)),
      /**/
      typeof window.__REDUX_DEVTOOLS_EXTENSION__ !== "undefined"
        ? window.__REDUX_DEVTOOLS_EXTENSION__()
        : f => f
    )
  );

  return { store, history };
}
Example #4
Source File: reducers.js    From rysolv with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Merges the main reducer with the router state and dynamically injected reducers
 */
export default function createReducer(injectedReducers = {}) {
  const rootReducer = combineReducers({
    language: languageProviderReducer,
    router: connectRouter(history),
    ...injectedReducers,
  });

  return rootReducer;
}
Example #5
Source File: rootReducer.js    From one-wallet with Apache License 2.0 6 votes vote down vote up
rootReducer = (history) => combineReducers({
  ...reducers,
  wallet: persistReducer({ ...walletPersistConfig, storage }, reducers.wallet),
  cache: persistReducer({ ...cachePersistConfig, storage }, reducers.cache),
  global: persistReducer({ ...globalPersistConfig, storage }, reducers.global),
  balance: persistReducer({ ...balancePersistConfig, storage }, reducers.balance),
  router: connectRouter(history),
  lastAction
})
Example #6
Source File: reducers.js    From bank-client with MIT License 6 votes vote down vote up
/**
 * Merges the main reducer with the router state and dynamically injected reducers
 */
export default function createReducer(injectedReducers = {}) {
  const rootReducer = combineReducers({
    global: globalReducer,
    language: languageProviderReducer,
    loading: loadingProviderReducer,
    error: errorProviderReducer,
    router: connectRouter(history),
    ...injectedReducers,
  });

  return rootReducer;
}
Example #7
Source File: configureStore.js    From HexactaLabs-NetCore_React-Level1 with Apache License 2.0 6 votes vote down vote up
export default function configureStore(history, initialState) {
  const reducers = {
    form: formReducer,
    router: connectRouter(history),
    auth,
    home,
    provider,
    store,
    producttype
  };

  const middleware = [thunk, routerMiddleware(history)];

  const enhancers = [];
  // eslint-disable-next-line no-undef
  const isDevelopment = process.env.NODE_ENV === "development";

  if (
    isDevelopment &&
    typeof window !== "undefined" &&
    window.devToolsExtension
  ) {
    enhancers.push(window.devToolsExtension());
  }

  const rootReducer = combineReducers(reducers);

  return createStore(
    rootReducer,
    initialState,
    compose(
      applyMiddleware(...middleware),
      ...enhancers
    )
  );
}
Example #8
Source File: index.js    From loopring-pay with Apache License 2.0 6 votes vote down vote up
rootReducer = (history) =>
  combineReducers({
    router: connectRouter(history),
    exchange: ExchangeInfoReducer,
    tabs: TabsReducer,
    tradePanel: TradePanelReducer,
    layoutManager: LayoutManagerReducer,
    liquidityMining: LiquidityMiningReducer,
    // TODO: Refactor market in redux
    market: combineReducers({
      currentMarket: CurrentMarketReducer,
      orderBook: OrderBookReducer,
      tradeHistory: TradeHistoryReducer,
      ticker: TickerReducer,
    }),
    currentMarket: CurrentMarketReducer,
    orderBook: OrderBookReducer,
    tradeHistory: TradeHistoryReducer,
    ticker: TickerReducer,
    modalManager: ModalManagerReducer,
    balances: MyAccountPageReducer,
    myOrders: MyOrdersReducer,
    myOrderPage: MyOrderPageReducer,
    metaMask: MetaMaskReducer,
    walletConnect: WalletConnectReducer,
    dexAccount: DexAccountReducer,
    nonce: NonceReducer,
    gasPrice: GasPriceReducer,
    cmcPrice: CmcPriceReducer,
    userPreferences: UserPreferenceManagerReducer,
    notifyCenter: NotifyCenterReducer,
  })
Example #9
Source File: configureStore.js    From HexactaLabs-NetCore_React-Level1 with Apache License 2.0 6 votes vote down vote up
export default function configureStore(history, initialState) {
  const reducers = {
    form: formReducer,
    router: connectRouter(history),
    auth,
    home,
    provider,
    producttype,
    store,
  };

  const middleware = [thunk, routerMiddleware(history)];

  const enhancers = [];
  // eslint-disable-next-line no-undef
  const isDevelopment = process.env.NODE_ENV === "development";

  if (
    isDevelopment &&
    typeof window !== "undefined" &&
    window.devToolsExtension
  ) {
    enhancers.push(window.devToolsExtension());
  }

  const rootReducer = combineReducers(reducers);

  return createStore(
    rootReducer,
    initialState,
    compose(applyMiddleware(...middleware), ...enhancers)
  );
}
Example #10
Source File: configureStore.js    From HexactaLabs-NetCore_React-Final with Apache License 2.0 6 votes vote down vote up
export default function configureStore(history, initialState) {
  const reducers = {
    form: formReducer,
    router: connectRouter(history),
    auth,
    home,
    provider,
    product,
    productType,
    store
  };

  const middleware = [thunk, routerMiddleware(history)];

  const enhancers = [];
  // eslint-disable-next-line no-undef
  const isDevelopment = process.env.NODE_ENV === "development";

  if (
    isDevelopment &&
    typeof window !== "undefined" &&
    window.devToolsExtension
  ) {
    enhancers.push(window.devToolsExtension());
  }

  const rootReducer = combineReducers(reducers);

  return createStore(
    rootReducer,
    initialState,
    compose(
      applyMiddleware(...middleware),
      ...enhancers
    )
  );
}
Example #11
Source File: root.reducer.js    From horondi_client_fe with MIT License 6 votes vote down vote up
rootReducer = (history) =>
  combineReducers({
    router: connectRouter(history),
    User,
    Error,
    Language,
    CommonStore,
    Toast,
    Products,
    Currency,
    Constructor,
    Order
  })
Example #12
Source File: root.reducer.js    From horondi_admin with MIT License 6 votes vote down vote up
rootReducer = (history) =>
  combineReducers({
    Contact: contactsReducer,
    News,
    Theme,
    Table,
    Snackbar,
    DialogWindow,
    Auth,
    router: connectRouter(history),
    Material,
    Pattern,
    BusinessPages,
    Products,
    Categories,
    Users,
    Comments,
    Sizes,
    Orders,
    Model,
    EmailQuestions,
    HomePage,
    Stats: statsReducer,
    Header,
    Slides,
    Error,
    Color,
    Constructor,
    History,
    Back,
    Bottom,
    Pockets,
    Closures,
    Positions,
    Basics,
    Straps,
    Currencies,
    QuestionsAnswers
  })
Example #13
Source File: reducers.js    From hackchat-client with Do What The F*ck You Want To Public License 6 votes vote down vote up
/**
 * Exports an object container the root reducer, router state, i18n and injected reducers
 * @param {object} injectedReducers Dynamically loaded reducers
 * @public
 * @return {object}
 */
export default function createReducer(injectedReducers = {}) {
  const rootReducer = combineReducers({
    router: connectRouter(history),
    language: languageProviderReducer,
    ...injectedReducers,
  });

  return rootReducer;
}
Example #14
Source File: reducers.js    From QiskitFlow with Apache License 2.0 6 votes vote down vote up
/**
 * Merges the main reducer with the router state and dynamically injected reducers
 */
export default function createReducer(injectedReducers = {}) {
  const rootReducer = combineReducers({
    global: globalReducer,
    language: languageProviderReducer,
    router: connectRouter(history),
    ...injectedReducers,
  });

  return rootReducer;
}
Example #15
Source File: rootReducer.js    From juggernaut-desktop with MIT License 6 votes vote down vote up
export default function createRootReducer(history) {
  return combineReducers({
    router: connectRouter(history),
    wallets: walletsReducer,
    conversations: conversationsReducer,
    messages: messagesReducer,
    wallet: walletReducer,
    channels: channelsReducer,
    transactions: transactionsReducer,
    peers: peersReducer,
    nodes: nodesReducer,
    chat: chatReducer,
    app: appReducer
  });
}
Example #16
Source File: rootReducer.js    From NoteMaster with GNU General Public License v3.0 6 votes vote down vote up
// Root reducer
export default function createRootReducer(history: HashHistory) {
  return combineReducers<{}, *>({
    router: connectRouter(history),
    window: windowReducer,
    monaco: monacoReducer,
    preferences: preferencesReducer,
    contextEvaluation: contextEvaluationReducer
  });
}
Example #17
Source File: index.js    From dexwebapp with Apache License 2.0 6 votes vote down vote up
rootReducer = (history) =>
  combineReducers({
    router: connectRouter(history),
    exchange: ExchangeInfoReducer,
    tabs: TabsReducer,
    tradePanel: TradePanelReducer,
    layoutManager: LayoutManagerReducer,
    liquidityMining: LiquidityMiningReducer,
    currentMarket: CurrentMarketReducer,
    orderBook: OrderBookReducer,
    tradeHistory: TradeHistoryReducer,
    ticker: TickerReducer,
    modalManager: ModalManagerReducer,
    balances: MyAccountPageReducer,
    myOrders: MyOrdersReducer,
    myOrderPage: MyOrderPageReducer,
    metaMask: MetaMaskReducer,
    walletConnect: WalletConnectReducer,
    walletLink: WalletLinkReducer,
    mewConnect: MewConnectReducer,
    authereum: AuthereumReducer,
    dexAccount: DexAccountReducer,
    nonce: NonceReducer,
    gasPrice: GasPriceReducer,
    legalPrice: LegalPriceReducer,
    commissionReward: CommissionRewardReducer,
    userPreferences: UserPreferenceManagerReducer,
    notifyCenter: NotifyCenterReducer,
  })
Example #18
Source File: configureStore.js    From HexactaLabs-NetCore_React-Level2 with Apache License 2.0 6 votes vote down vote up
export default function configureStore(history, initialState) {
  const reducers = {
    form: formReducer,
    router: connectRouter(history),
    auth,
    home,
    provider,
    productType,
    store
  };

  const middleware = [thunk, routerMiddleware(history)];

  const enhancers = [];
  // eslint-disable-next-line no-undef
  const isDevelopment = process.env.NODE_ENV === "development";

  if (
    isDevelopment &&
    typeof window !== "undefined" &&
    window.devToolsExtension
  ) {
    enhancers.push(window.devToolsExtension());
  }

  const rootReducer = combineReducers(reducers);

  return createStore(
    rootReducer,
    initialState,
    compose(
      applyMiddleware(...middleware),
      ...enhancers
    )
  );
}
Example #19
Source File: index.js    From archeage-tools with The Unlicense 6 votes vote down vote up
rootReducer = (history) => combineReducers({
  dailies,
  display,
  calendar,
  folio,
  gameData,
  itemPrice,
  mounts,
  myGame,
  notification,
  proficiencies,
  router: connectRouter(history),
  session,
  crops,
  taxes,
  tradepacks,
  users,
})
Example #20
Source File: reducers.js    From substrate-authn-faucet-frontend with GNU General Public License v3.0 6 votes vote down vote up
createReducer = history => {
  return combineReducers({
    router: connectRouter(history),
    signupReducer,
    browser: createResponsiveStateReducer({
      mobile: 320,
      tablet: 768,
      desktop: 1024
    })
  });
}
Example #21
Source File: index.js    From React-Nest-Admin with MIT License 6 votes vote down vote up
export default function configureStore() {
  const middlewares = [ReduxThunk, routerMiddleware(history)];

  const enhancers = [applyMiddleware(...middlewares)];

  // use redux devtool, redux-thunk middleware
  const composeEnhancers =
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

  const store = createStore(
    connectRouter(history)(persistedReducer),
    composeEnhancers(...enhancers)
  );

  const persistor = persistStore(store);

  return { store, persistor };
}
Example #22
Source File: store.js    From react-14.01 with MIT License 5 votes vote down vote up
reducer = combineReducers({
	chatReducer,
	profileReducer,
	router: connectRouter(history),
})
Example #23
Source File: index.js    From ant-simple-pro with MIT License 5 votes vote down vote up
Reducer = combineReducers({
  router: connectRouter(history), // 采用connected-react-router
  user,
  other
})
Example #24
Source File: reducer.js    From relay_11 with MIT License 5 votes vote down vote up
rootReducer = combineReducers({
    register: registerReducer,
    router: connectRouter(history),
})
Example #25
Source File: index.js    From mern-stack with MIT License 5 votes vote down vote up
createRootReducer = (history) =>
  combineReducers({
    router: connectRouter(history),
    form: formReducer,
    auth: authReducer,
  })
Example #26
Source File: index.js    From resumeker-fe with MIT License 5 votes vote down vote up
createRootReducer = (history) =>
    combineReducers({
        router: connectRouter(history),
        resumeFormReducer,
    })
Example #27
Source File: index.js    From react-03.03 with MIT License 5 votes vote down vote up
reducer = combineReducers({
    chats: chatReducer,
    router: connectRouter(history),
})
Example #28
Source File: rootReducer.js    From React-Nest-Admin with MIT License 5 votes vote down vote up
createRootReducer = history =>
  combineReducers({
    router: connectRouter(history),
    layout: layoutReducer,
    auth: authReducer
  })
Example #29
Source File: index.js    From react-03.03 with MIT License 5 votes vote down vote up
reducer = combineReducers({
    chats: chatReducer,
    router: connectRouter(history),
})