@reduxjs/toolkit#configureStore TypeScript Examples

The following examples show how to use @reduxjs/toolkit#configureStore. 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: store.ts    From overwolf-modern-react-boilerplate with MIT License 7 votes vote down vote up
reduxStore = configureStore({
  reducer: rootReducer,
  devTools: false,
  enhancers:
    process.env.NODE_ENV === 'development'
      ? [
          devToolsEnhancer({
            realtime: true,
            name: 'Overwolf ',
            hostname: 'localhost',
            port: 8000,
          }),
        ]
      : [],
})
Example #2
Source File: configureStore.ts    From oasis-wallet-web with Apache License 2.0 6 votes vote down vote up
export function configureAppStore(state?: Partial<RootState>) {
  const sagaMiddleware = createSagaMiddleware({
    onError: (error, info) => {
      store.dispatch(
        fatalErrorActions.setError({
          message: error.toString(),
          stack: error.stack,
          sagaStack: info.sagaStack,
        }),
      )
    },
  })

  // Create the store with saga middleware
  const middlewares = [sagaMiddleware]

  const store = configureStore({
    reducer: createReducer(),
    middleware: getDefaultMiddleware => getDefaultMiddleware().concat(middlewares),
    devTools:
      /* istanbul ignore next line */
      process.env.NODE_ENV !== 'production',
    preloadedState: state,
  })

  sagaMiddleware.run(rootSagas)

  return store
}
Example #3
Source File: index.ts    From cheeseswap-interface with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS })
})
Example #4
Source File: index.ts    From dyp with Do What The F*ck You Want To Public License 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS })
})
Example #5
Source File: index.ts    From ace with GNU Affero General Public License v3.0 6 votes vote down vote up
projectStore = configureStore({
    reducer,
    middleware: [
        (store) => (next) => (action) => {
            const ret = next(action);

            const state = store.getState();

            if (CANVAS_SAVE_ACTIONS.includes(action.type)) {
                QueuedDataWriter.enqueueCanvasWrite();
            }

            if (SIMVAR_CONTROL_SAVE_ACTIONS.includes(action.type)) {
                handleSaveSimVarControlState(state);
            }

            if (SIMVAR_VALUES_SAVE_ACTIONS.includes(action.type)) {
                QueuedDataWriter.enqueueSimVarValuesWrite();
            }

            if (PERSISTENT_STORAGE_SAVE_ACTIONS.includes(action.type)) {
                QueuedDataWriter.enqueuePersistentDataWrite();
            }

            return ret;
        },
    ],
})
Example #6
Source File: index.ts    From glide-frontend with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  devTools: process.env.NODE_ENV !== 'production',
  reducer: {
    // achievements: achievementsReducer,
    block: blockReducer,
    farms: farmsReducer,
    pools: poolsReducer,
    community: communityReducer,
    info: infoReducer,
    // predictions: predictionsReducer,
    // profile: profileReducer,
    // teams: teamsReducer,
    collectibles: collectiblesReducer,
    // voting: votingReducer,
    // lottery: lotteryReducer,

    // Exchange
    application,
    user,
    transactions,
    swap,
    bridge,
    mint,
    burn,
    multicall,
    lists,
  },
  middleware: [...getDefaultMiddleware({ thunk: true }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS }),
})
Example #7
Source File: index.ts    From skeleton-web3-interface with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    multicall,
    lists
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS })
})
Example #8
Source File: store.ts    From peterportal-client with MIT License 6 votes vote down vote up
store = configureStore({
    reducer: {
        review: reviewReducer,
        ui: uiReducer,
        popup: popupReducer,
        roadmap: roadmapReducer,
        search: searchReducer,
    }
})
Example #9
Source File: store.ts    From xcloud-keyboard-mouse with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(process.env.NODE_ENV === 'production' ? [] : [logger]),
  reducer: {
    gameName: currentGameReducer,
    enabled: enabledReducer,
    active: activeConfigReducer,
    configs: configDetailsReducer,
    pending: pendingStatusesReducer,
  },
})
Example #10
Source File: index.ts    From SkyOffice with MIT License 6 votes vote down vote up
store = configureStore({
  reducer: {
    user: userReducer,
    computer: computerReducer,
    whiteboard: whiteboardReducer,
    chat: chatReducer,
    room: roomReducer,
  },
  // Temporary disable serialize check for redux as we store MediaStream in ComputerStore.
  // https://stackoverflow.com/a/63244831
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: false,
    }),
})
Example #11
Source File: store.ts    From kryptovero.github.io with MIT License 6 votes vote down vote up
store = configureStore({
  reducer: {
    events: eventsSlice.reducer,
    [coinbaseApi.reducerPath]: coinbaseApi.reducer,
    isPrefilling: isPrefillingSlice.reducer,
  },
  middleware: (getDefaultMiddleware) => [
    ...getDefaultMiddleware(),
    sagaMiddleware,
    coinbaseApi.middleware,
  ],
})
Example #12
Source File: store.ts    From meshtastic-web with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    app: appReducer,
    meshtastic: meshtasticReducer,
    map: mapReducer,
  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: false,
    }),
})
Example #13
Source File: index.ts    From mozartfinance-swap-interface with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
    toasts
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: loadedState,
})
Example #14
Source File: store.ts    From tailchat with GNU General Public License v3.0 6 votes vote down vote up
export function createStore() {
  const store = configureStore({
    reducer: appReducer,
    middleware: (getDefaultMiddleware) => getDefaultMiddleware(),
    devTools: process.env.NODE_ENV !== 'production',
  });

  return store;
}
Example #15
Source File: index.ts    From pancake-swap-exchange-testnet with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
    toasts
  },
  // @ts-ignore
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  // @ts-ignore
  preloadedState: loadedState,
})
Example #16
Source File: index.ts    From goose-frontend-amm with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: loadedState,
})
Example #17
Source File: store.ts    From deskreen with GNU Affero General Public License v3.0 6 votes vote down vote up
configuredStore = (initialState?: RootState) => {
  // Create Store
  const store = configureStore({
    reducer: rootReducer,
    middleware,
    preloadedState: initialState,
  });

  if (process.env.NODE_ENV === 'development' && module.hot) {
    module.hot.accept(
      './rootReducer',
      // eslint-disable-next-line global-require
      () => store.replaceReducer(require('./rootReducer').default)
    );
  }
  return store;
}
Example #18
Source File: configureStore.ts    From react-boilerplate-cra-template with MIT License 6 votes vote down vote up
export function configureAppStore() {
  const reduxSagaMonitorOptions = {};
  const sagaMiddleware = createSagaMiddleware(reduxSagaMonitorOptions);
  const { run: runSaga } = sagaMiddleware;

  // Create the store with saga middleware
  const middlewares = [sagaMiddleware];

  const enhancers = [
    createInjectorsEnhancer({
      createReducer,
      runSaga,
    }),
  ] as StoreEnhancer[];

  const store = configureStore({
    reducer: createReducer(),
    middleware: [...getDefaultMiddleware(), ...middlewares],
    devTools: process.env.NODE_ENV !== 'production',
    enhancers,
  });

  return store;
}
Example #19
Source File: store.ts    From postcode with MIT License 6 votes vote down vote up
store = configureStore({
  reducer: {
    requestAuth: requestAuthReducer,
    requestBody: requestBodyReducer,
    requestHeader: requestHeaderReducer,
    requestMethod: requestMethodReducer,
    requestUrl: requestUrlReducer,
    response: responseReducer,
    codeGenOptions: codeGenOptionsReducer,
    requestOptions: requestOptionsReducer,
  },
  preloadedState,
})
Example #20
Source File: configureStore.ts    From datart with Apache License 2.0 6 votes vote down vote up
export function configureAppStore() {
  const enhancers = [injectReducerEnhancer(createReducer)];

  const store = configureStore({
    reducer: createReducer(),
    middleware: getDefaultMiddleware =>
      getDefaultMiddleware({
        serializableCheck: false,
        // immutableCheck: false,
      }).prepend(rejectedErrorHandlerMiddleware.middleware),
    devTools:
      /* istanbul ignore next line */
      process.env.NODE_ENV !== 'production' ||
      process.env.PUBLIC_URL.length > 0,
    enhancers,
  });

  return store;
}
Example #21
Source File: store.ts    From sapio-studio with Mozilla Public License 2.0 6 votes vote down vote up
store = configureStore({
    reducer: {
        entityReducer,
        appReducer,
        contractCreatorReducer,
        simulationReducer,
        settingsReducer,
        modalReducer,
        dataReducer,
        walletReducer,
    },
    middleware: [thunk],
    devTools: true,
})
Example #22
Source File: Counter.spec.tsx    From memex with MIT License 6 votes vote down vote up
function setup(
  preloadedState: { counter: { value: number } } = { counter: { value: 1 } }
) {
  const store = configureStore({
    reducer: { counter: counterSlice.default },
    preloadedState,
  });

  const getWrapper = () =>
    mount(
      <Provider store={store}>
        <Router>
          <Counter />
        </Router>
      </Provider>
    );
  const component = getWrapper();
  return {
    store,
    component,
    buttons: component.find('button'),
    p: component.find('.counter'),
  };
}
Example #23
Source File: index.ts    From forward.swaps with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
    waitmodal
  },
  middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS })
})
Example #24
Source File: index.ts    From Account-Manager with MIT License 6 votes vote down vote up
store = configureStore({
  reducer: {
    accountBalances: accountBalancesReducer,
    app: appReducers,
    banks: bankReducers,
    managedAccountBalances: managedAccountBalancesReducer,
    notifications: notificationsReducer,
    sockets: socketReducers,
    validators: validatorReducers,
  },
})
Example #25
Source File: configureStore.ts    From covid19-trend-map with Apache License 2.0 6 votes vote down vote up
configureAppStore = (preloadedState:PartialRootState = {})=>{

    const store = configureStore({
        reducer: rootReducer,
        middleware:[ 
            ...getDefaultMiddleware<RootState>()
        ],
        preloadedState
    });

    return store
}
Example #26
Source File: configureStore.ts    From optica with Apache License 2.0 6 votes vote down vote up
configureAppStore = (preloadedState: PartialRootState = {}) => {
    const store = configureStore({
        reducer: rootReducer,
        middleware: [...getDefaultMiddleware<RootState>()],
        preloadedState,
    });

    return store;
}
Example #27
Source File: index.ts    From vvs-ui with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  devTools: process.env.NODE_ENV !== 'production',
  reducer: {
    // achievements: achievementsReducer,
    block: blockReducer,
    farms: farmsReducer,
    pools: poolsReducer,
    // predictions: predictionsReducer,
    profile: profileReducer,
    // teams: teamsReducer,
    // collectibles: collectiblesReducer,
    // voting: votingReducer,
    // lottery: lotteryReducer,
    info: infoReducer,

    // Exchange
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
  },
  middleware: [...getDefaultMiddleware({ thunk: true }), save({ states: PERSISTED_KEYS })],
  preloadedState: load({ states: PERSISTED_KEYS }),
})
Example #28
Source File: index.ts    From pancakeswap-testnet with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    application,
    user,
    transactions,
    swap,
    mint,
    burn,
    multicall,
    lists,
    toasts
  },
  // middleware: [...getDefaultMiddleware({ thunk: false }), save({ states: PERSISTED_KEYS })],
  middleware: getDefaultMiddleware({ thunk: false }).concat(save({ states: PERSISTED_KEYS })),
  preloadedState: loadedState,
})
Example #29
Source File: index.ts    From your_spotify with GNU General Public License v3.0 6 votes vote down vote up
store = configureStore({
  reducer: {
    user: userReducer,
    settings: settingsReducer,
    message: messageReducer,
    admin: adminReducer,
    import: importReducer,
  },
})