redux-localstorage-adapter
Localstorage adapter for redux
Main points
- Keep your components pure.
- Sync localstorage and store and use actions to change it.
Setup
your/known-localstorage-api.js
; const knownLocalStorageKeys = 'NEWS_SIMILAR_ENTRIES_TEMPLATE' 'FIRE_THEME_ENABLED'; const knownApi = {}; knownLocalStorageKeys; ;
your/localstorage-reducer.js
;; _;
your/index-reducer.js
;; localStorage //..;
your/localstorage-actions.js
; ;
Usage
your/some-redux-container.js
; /... { thisprops; }/... const mapStateToProps = fireEnabled: statelocalStorageFIRE_THEME_ENABLED; const mapDispatchToProps = setFire: localStorageActionsFIRE_THEME_ENABLEDsetItem mapStateToProps mapDispatchToPropsSomeComponent;