Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,28 @@ const rootReducer = combineReducers({
export default persistReducer(rootPersistConfig, rootReducer)
```

## Nested Persists - Config Alternative
Since 25th March 2022, it is possible to use an alternative way of setting nested persist configuration.
There is a new package called [Redux Deep Persist](https://github.com/PiotrKujawa/redux-deep-persist) and there is a helper method _getPersistConfig_ to get a redux persist config for nested state no matter how deep you want it to be persisted.

**Example of usage:**

```js
import { getPersistConfig } from 'redux-deep-persist';

const config = getPersistConfig({
key: 'root',
storage: AsyncStorage, // whatever storage you use
whitelist: [
'property1.a1.b1',
'property1.a2.b2.c2', // no matter how deep you go
'property2.a2',
],
rootReducer, // your root reducer must be also passed here
... // any other props from original redux-persist config omitting the stateReconciler
})
```

## Migrations
`persistReducer` has a general purpose "migrate" config which will be called after getting stored state but before actually reconciling with the reducer. It can be any function which takes state as an argument and returns a promise to return a new state object.

Expand Down