https://github.com/osedea/redux-persist-realm
A Realmjs interface for redux-persist
https://github.com/osedea/redux-persist-realm
Last synced: 10 months ago
JSON representation
A Realmjs interface for redux-persist
- Host: GitHub
- URL: https://github.com/osedea/redux-persist-realm
- Owner: Osedea
- License: mit
- Created: 2017-08-19T21:42:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T04:25:26.000Z (over 6 years ago)
- Last Synced: 2025-07-30T05:23:36.510Z (10 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 39
- Watchers: 7
- Forks: 17
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Redux-persist-realm
A Realmjs interface for redux-persist
## Dependencies
- Realm : [Docs](https://realm.io/docs/javascript/latest/), [npm](https://www.npmjs.com/package/realm)
- Redux-persist : [Docs](https://github.com/rt2zz/redux-persist), [npm](https://www.npmjs.com/package/redux-persist)
## Installation
### If you already have realm and redux-persist
```
npm i --save redux-persist-realm
# or
yarn add redux-persist-realm
```
### Else
```
npm i --save redux-persist realm redux-persist-realm
# or
yarn add redux-persist realm redux-persist-realm
react-native link realm
```
## Usage
```diff
import {compose, applyMiddleware, createStore} from 'redux'
import {persistStore, autoRehydrate} from 'redux-persist'
+ import realmPersistInterface from 'redux-persist-realm'
// 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: realmPersistInterface
+ }
// begin periodically persisting the store
- persistStore(store)
+ persistStore(store, config)
```
Don't hesitate to publish [Issues](https://github.com/Osedea/redux-persist-realm/issues) if you see something missing!