Skip to content

Instantly share code, notes, and snippets.

@paveltretyakovru
Created March 18, 2022 12:17
Show Gist options
  • Save paveltretyakovru/bdf23071c1bfc187efd1383fdd9d3e53 to your computer and use it in GitHub Desktop.
Save paveltretyakovru/bdf23071c1bfc187efd1383fdd9d3e53 to your computer and use it in GitHub Desktop.
redux + saga (fix to getDefaultMiddleware is deprecated)
import createSagaMiddleware from 'redux-saga';
import { configureStore } from '@reduxjs/toolkit';
import saga from './saga';
import { reducer as app } from 'app/app.slice';
import { counterSlice } from 'core/features/counter/counter.slice';
const sagaMiddleware = createSagaMiddleware();
export const store = configureStore({
reducer: {
app,
counter: counterSlice.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(sagaMiddleware),
});
sagaMiddleware.run(saga);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment