Skip to content

Latest commit

 

History

History

redux-cube-with-persist

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

redux-cube-with-persist

< Back to Project WebCube

NPM Version

Nodei

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

Get Started

// 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() {
    // ...
  }
}