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.
#
ParametersconfigureSagaStore
accepts a single configuration object parameter, with the same options as configureStore from Redux ToolKit.
#
Usage#
Exampleimport { configureSagaStore } from '@vmw/queue-for-redux-saga';
const store = configureSagaStore({ reducer: rootReducer,});
#
NoteconfigureSagaStore
requires the Redux Toolkit '@reduxjs/toolkit' peer dependency.
To use runSaga
without Redux Toolkit, see setSagaRunner
.
#
Implementation DetailsThe 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;}