A Realmjs interface for redux-persist
npm i --save redux-persist-realm
# or
yarn add redux-persist-realm
npm i --save redux-persist realm redux-persist-realm
# or
yarn add redux-persist realm redux-persist-realm
react-native link realm
import {compose, applyMiddleware, createStore} from 'redux'
import {persistStore, autoRehydrate} from 'redux-persist'
+ import RealmPersistInterface from 'redux-persist-realm'
+ const storage = RealmPersistInterface.instance;
// add `autoRehydrate` as an enhancer to your store (note: `autoRehydrate` is not a middleware)
const store = createStore(
reducer,
undefined,
compose(
applyMiddleware(...),
autoRehydrate()
)
)
+ const config = {
+ storage
+ }
// begin periodically persisting the store
- persistStore(store)
+ persistStore(store, config)
Don't hesitate to publish Issues if you see something missing!