I have some slices that use Set
s in their state. I have this code:
import { configureStore } from '@reduxjs/toolkit';
import { enableMapSet } from 'immer';
import { reducers } from './reducers';
enableMapSet();
export function configureStore() {
const rootReducer = combineReducers({
...reducers,
});
return configureStore({
reducer: rootReducer,
});
}
const store = configureStore();
export type AppDispatch = typeof store.dispatch;
export default store;
Although I installed the immer
and call enableMapSet()
, I still get an error when my app loaded:
Unhandled Rejection (Error): [Immer] The plugin for 'MapSet' has not been loaded into Immer. To enable the plugin, import and call
enableMapSet()
when initializing your application.
How should I configure the enableMapSet
with Redux Toolkit?