@runningcodertest/rematch-persist
v0.0.4
Published
Redux-Persist v5 plugin for Rematch. Provides simple redux state persistence using local storage options.
Downloads
5
Maintainers
Readme
Rematch Persist
Redux-Persist v5 plugin for Rematch.
Provides simple redux state persistence using local storage options.
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>
}