persist-check-version-transform

0.0.9 • Public • Published

Redux-persist check version transform

Redux persist with version information.

Install

yarn add https://github.com/devx-agency/redux-persist-check-version-transform

Usage

const persistWhitelist = ['userData', 'product']
const reduxStore = {
  userData: {
    redux: require('../Redux/UserDataRedux'),
    blacklist: ['username'],
    encrypt: true,
    version: 1
  },
  product: {
    redux: require('../Redux/ProductRedux'),
    whitelist: ['productName'],
    version: 1
  }
}
const pass = 'pass'
const persistConfig = { // 'redux-persist' config
  key: 'devx',
  storage: localForage,
  transforms: [immutableTransform(), persistCheckVersionTransform(reduxStore, persistWhitelist, pass)],
  whitelist: persistWhitelist
}

Configuration

Variable Type Description
persistWhitelist Array which redux will be stored
reduxStore {[key: string]: Options} configuration of persist tranform
pass string password for encrypted data

Options

Variable Type Description
redux imported redux
blacklist Array variables will not be persisted
whitelist Array only this variables will be persisted
encrypt boolean default false if data should be persisted
version number data version

When version is incresed, old data will be deleted.

State reconciler

import { stateReconcilerImmutable } from 'persist-check-version-transform'

Thanks to V&T

Readme

Keywords

none

Package Sidebar

Install

npm i persist-check-version-transform

Weekly Downloads

131

Version

0.0.9

License

none

Unpacked Size

11.6 kB

Total Files

9

Last publish

Collaborators

  • devx