redux-cube's pluggable module for redux-persist
npm install --save redux-cube-with-persist
NOTE: redux-cube-with-persist cannot be used with redux-cube-with-immutable
// xxx/App.jsx
import { createApp } from 'redux-cube';
import withPersist from 'redux-cube-with-persist';
import localforage from 'localforage';
import withRouter from 'redux-cube-with-router';
@createApp(withPersist(withRouter({
reducers: {
// ...
},
// optional
// https://github.com/rt2zz/redux-persist#storage-engines
persistStorage: localforage,
// optional
// https://github.com/rt2zz/redux-persist/blob/master/docs/api.md#type-persistconfig
persistKey = 'persistRoot',
// optional
// https://github.com/rt2zz/redux-persist/blob/master/docs/api.md#type-persistconfig
persistConfig: {
// ...
},
// optional
// https://github.com/rt2zz/redux-persist-transform-immutable#usage-with-records
persistImmutableConfig: {
// ...
},
// ...
}))))
class SubApp extends PureComponent {
render() {
// ...
}
}