When rehydrating, spread the reducer's defaults before restoring the object.
- Includes new properties without a migration.
yarn add redux-persist-transform-include-defaults
import { persistReducerIncludeDefaults } from 'redux-persist-transform-include-defaults';
const reducer = persistReducerIncludeDefaults(
{
// persist config
},
baseReducer
)
import { persistReducer } from 'redux-persist'
import transformIncludeDefaults from 'redux-persist-transform-include-defaults'
const reducer = persistReducer(
{
// persist config
transforms: [
transformIncludeDefaults(baseReducer),
]
},
baseReducer
)