My react-native app is not saving my data using redux toolkit, redux-persist and asyncstorage
import AsyncStorage from '@react-native-async-storage/async-storage';
import { configureStore } from '@reduxjs/toolkit';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import {
FLUSH,
PAUSE,
PERSIST,
persistReducer,
persistStore,
PURGE,
REGISTER,
REHYDRATE,
persistCombineReducers,
} from 'redux-persist';
import thunk from 'redux-thunk';
import authSlice from './authSlice';
const rootReducer = combineReducers({
authReducer: authSlice,
});
const persistConfig = {
key: 'root',
version: 1,
storage: AsyncStorage,
whiteList: ['authReducer'],
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
export default () => {
let store = createStore(
persistedReducer,
composeWithDevTools(applyMiddleware(thunk)),
);
let persistor = persistStore(store);
return { store, persistor };
};
Above is the config I made, I tried several config and in general redux works normally but redux-persist is not saving the data. When I refresh or close the app I lose the info that its supposed to be saved