import { configureStore } from '@reduxjs/toolkit' ; import { persistStore , persistReducer , FLUSH , REHYDRATE , PAUSE , PERSIST , PURGE , REGISTER , } from 'redux-persist' ; import AsyncStorage from '@react-native-async-storage/async-storage' ; import rootReducer from './rootReducer' ; const persistConfig = { key : 'root' , version : 2 , storage : AsyncStorage , } ; const persistedReducer = persistReducer ( persistConfig , rootReducer ) ; export const store = configureStore ( { reducer : persistedReducer , middleware : ( getDefaultMiddleware ) => getDefaultMiddleware ( { serializableCheck : { ignoredActions : [ FLUSH , REHYDRATE , PAUSE , PERSIST , PURGE , REGISTER ] , } , } ) , } ) ; export type RootState = ReturnType < typeof rootReducer > ; export type AppDispatch = typeof store . dispatch ; export const persistor = persistStore ( store ) ;