Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 945 Bytes

File metadata and controls

43 lines (32 loc) · 945 Bytes

redux-persist-transform-include-defaults

npm

When rehydrating, spread the reducer's defaults before restoring the object.

  • Includes new properties without a migration.

Quickstart

yarn add redux-persist-transform-include-defaults

With Helper

import { persistReducerIncludeDefaults } from 'redux-persist-transform-include-defaults';

const reducer = persistReducerIncludeDefaults(
  {
    // persist config
  },
  baseReducer
)

Manually

import { persistReducer } from 'redux-persist'
import transformIncludeDefaults from 'redux-persist-transform-include-defaults'

const reducer = persistReducer(
  {
    // persist config
    transforms: [
      transformIncludeDefaults(baseReducer),
    ]
  },
  baseReducer
)