npm install @rematch/persist
针对 @rematch/core@0.x 使用 @rematch/persist@0.2.1
import createRematchPersist from '@rematch/persist'
const persistPlugin = createRematchPersist({
whitelist: ['modelName1'],
throttle: 5000,
version: 1,
})
init({
plugins: [persistPlugin]
})
import { getPersistor } from '@rematch/persist'
import { PersistGate } from 'redux-persist/es/integration/react'
const persistor = getPersistor()
const Root = () => {
<PersistGate persistor={persistor}>
<App />
</PersistGate>
}