redux-storage-decorator-migrate
Migrate decorator for redux-storage to version the storage with migration
Installation
npm install --save redux-storage-decorator-migrate
Usage
Versioned storage with migrations.
engine = ;engine;engine;engine;
Testing migrations without a store (applying against ad-hoc state)
import {buildMigrationEngine} from 'redux-storage-decorator-migrate'
const versionKey = 'redux-storage-decorators-migrate-version'
const someTestState = {
[versionKey]: 0,
myFancyStateProperty: 'A'
}
const someExampleMigration = {
version: 1,
migration: (state) => ({...state, myFancyStateProperty: 'B'})
}
const migrationEngine = buildMigrationEngine(1, versionKey, [someExampleMigration])
const migratedState = migrationEngine(someTestState)
console.log(migratedState.myFancyStateProperty)
// B
License
MIT