Skip to content

Files

Latest commit

dee1fff · Apr 16, 2018

History

History
52 lines (35 loc) · 1.03 KB

README.md

File metadata and controls

52 lines (35 loc) · 1.03 KB

Rematch Persist

Redux-Persist v5 plugin for Rematch.

Provides simple redux state persistence using local storage options.

persist

Install

npm install @rematch/persist

For @rematch/core@0.x use @rematch/persist@0.2.1

Setup

import createRematchPersist from '@rematch/persist'

const persistPlugin = createRematchPersist({
  whitelist: ['modelName1'],
  throttle: 5000,
  version: 1,
})

init({
  plugins: [persistPlugin]
})

Persist Gate

With React, display a loading indicator while waiting for data to async load from storage.

import { getPersistor } from '@rematch/persist'
import { PersistGate } from 'redux-persist/es/integration/react'

const persistor = getPersistor()

const Root = () => {
  <PersistGate persistor={persistor}>
    <App />
  </PersistGate>
}

Config Options

See redux-persist config docs