configureStore.ts
601 Bytes
import Types from 'local-types';
import { createStore, applyMiddleware } from 'redux';
import rootReducer from './rootReducer';
import { persistStore, persistReducer, PersistConfig } from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage';
import logger from 'redux-logger';
const persistConfig: PersistConfig<Types.RootState> = {
storage: AsyncStorage,
key: 'root',
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
export const store = createStore(persistedReducer, applyMiddleware(logger));
export const persistor = persistStore(store);