UNPKG

create-bz-mern-app

Version:

CLI to scaffold a fullstack React + Node.js app with Google login and JWT auth

26 lines (22 loc) 763 B
import { configureStore } from '@reduxjs/toolkit'; import user from './slices/User'; import { persistReducer, persistStore } from 'redux-persist'; import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web import { FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER } from 'redux-persist'; const persistConfig = { key: 'root', storage, }; const persistedUserReducer = persistReducer(persistConfig, user); export const store = configureStore({ reducer: { user: persistedUserReducer, }, middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], }, }), }); export const persistor = persistStore(store);