Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 660 Bytes

persist-storage.md

File metadata and controls

25 lines (21 loc) · 660 Bytes

Persist Storage

This feature provides automatic Redux state persistence for session. It relies on sessionStorage.

// Example using redux with @rematch
import { init } from '@rematch/core'
import persistPlugin from '@rematch/persist'
import { persistStorage } from 'near-social-bridge'
import { RootModel } from './models'

type FullModel = ExtraModelsFromLoading<RootModel, { type: 'full' }>

export const store = init<RootModel>({
  models,
  plugins: [
    // Provides automatic Redux state persistence.
    // https://rematchjs.org/docs/plugins/persist/
    persistPlugin({
      key: 'root',
      storage: persistStorage,
    }),
  ],
})