redux-persist-realmpackage
v1.0.3
Published
Interface for persist store in reducer
Downloads
4
Maintainers
Readme
- HOW TO USE
#IN STORE.JS
import { compose, createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import reducer from '../reducers'; import { persistReducer, persistStore } from 'redux-persist'; import realmPersistInstance from 'redux-persist-realm';
const persistConfig = { key: 'root', storage: realmPersistInstance }
const persistedReducer = persistReducer(persistConfig, reducer);
const store = createStore(persistedReducer, applyMiddleware(thunk)); const persistor = persistStore(store);
export { store, persistor }
#USE
import { store, persistor } from './src/redux/store';
import { PersistGate } from 'redux-persist/integration/react';
const renderAppWithRedux = () => ( );
AppRegistry.registerComponent('root', () => renderAppWithRedux);