Redux toolkit Presist Error

Hey guys im getting this error when i try to get presist in redux-toolkit. I have tried adding a middleware from the redux docs but getDefaultMiddleware is now depricated and the other stuff didnt work for me. Im curious if anyone has gone through this issue. (Working with redux toolkit cuz thats what my client wants )
import { configureStore } from '@reduxjs/toolkit';
import cartReducer from './state/cartSlice';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';

const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, cartReducer);

export const store = configureStore({
reducer: {
cart: persistedReducer,

},
});
export const persistor = persistStore(store);
import { configureStore } from '@reduxjs/toolkit';
import cartReducer from './state/cartSlice';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';

const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, cartReducer);

export const store = configureStore({
reducer: {
cart: persistedReducer,

},
});
export const persistor = persistStore(store);
This is my index.js store file for redux toolkit. Appreciate all the help i can get 🙂
No description
1 Reply
silverspy.
silverspy.•14mo ago
I fixed it if anyone wants to know in the future
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import cartReducer from './state/cartSlice';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';

const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, cartReducer);

export const store = configureStore({
reducer: {
cart: persistedReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: false,
}),
});
export const persistor = persistStore(store);
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import cartReducer from './state/cartSlice';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';

const persistConfig = {
key: 'root',
storage,
};
const persistedReducer = persistReducer(persistConfig, cartReducer);

export const store = configureStore({
reducer: {
cart: persistedReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: false,
}),
});
export const persistor = persistStore(store);
Want results from more Discord servers?
Add your server