Skip to content

Latest commit

 

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/[email protected] use @rematch/[email protected]

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/lib/integration/react'

const persistor = getPersistor()

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

Config Options

See redux-persist config docs