Package Exports
- reactjs-localstorage
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (reactjs-localstorage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
reactLocalStorage
Easy use localstorage in Reactjs
https://www.npmjs.com/package/reactjs-localstorage
Installation
npm install reactjs-localstorageor
yarn add reactjs-localstorageExamples
import {reactLocalStorage} from 'reactjs-localstorage';
reactLocalStorage.set('var', true);
reactLocalStorage.get('var', true);
reactLocalStorage.setObject('var', {'test': 'test'});
reactLocalStorage.getObject('var');
reactLocalStorage.remove('var');
reactLocalStorage.clear();Test
npm run testAPI Guide
reactLocalStorage.set(key, value)reactLocalStorage.get(key, deafultValue=undefined, silent=true)reactLocalStorage.setObject(key, object)reactLoacStorage.getObject(key, defaultValue={}, silent=true)reactLocalStorage.remove(key)reactLocalStorage.clear()
silent:
true: Will not throw exception instead will return defaultValuefalse: Will throw exception
License
MIT