Skip to main content

configureSagaStore

configureSagaStore wraps the "Redux ToolKit: configureStore".
The returned store will always have the Saga Middleware and by default will not have the Thunk Middleware.

Parameters#

configureSagaStore accepts a single configuration object parameter, with the same options as configureStore from Redux ToolKit.

Usage#

Example#

import { configureSagaStore } from '@vmw/queue-for-redux-saga';
const store = configureSagaStore({  reducer: rootReducer,});

Note#

configureSagaStore requires the Redux Toolkit '@reduxjs/toolkit' peer dependency.
To use runSaga without Redux Toolkit, see setSagaRunner.

Implementation Details#

The approximate internal implementation of configureSagaStore is:

export function configureSagaStore(options) {  const { middleware: middlewareParam } = options;
  let middleware = middlewareParam    ? middlewareParam    : getDefaultMiddleware({ thunk: false });
  const sagaMiddleware = createSagaMiddleware();
  middleware = [...middleware, sagaMiddleware];
  const store = configureStore({    ...options,    middleware,  });
  setSagaRunner(sagaMiddleware);  return store;}