react-localstorage-handler
This package helps handle localstorage data. get, set, delete item from local storage. It can even check if a key in localstorage.
Installation
Add React-localStorage-handler to your project by executing
$ npm install react-localstorage-handler or $ yarn add react-localstorage-handler
and that's it, you're good to go!
Usage
To check if a key exists use the checkStorage()
//import the checkStorage into your project import
#
To Add key and value to LocalStorage addStorage()
//import the checkStorage into your project import
#
To Retrieve a value by the key from LocalStorage getStorage()
//import the checkStorage into your project import
#
To Remove an item by key from LocalStorage removeStorage()
//import the checkStorage into your project import
#
To Clear all LocalStorage clearStorage()
//import the checkStorage into your project import
Props
all React-localStorage-handler
Name | Use |
---|---|
checkStorage | check is a key is saved in local storage |
addStorage | Add key and value to LocalStorage |
getStorage | Retrieve a value by the key from LocalStorage |
removeStorage | Remove an item by key from LocalStorage |
clearStorage | Clear all LocalStorage for that domain |
Contributing
Feel free to contribute, just send a pull request ;)
Licensing
This project is licensed under MIT license.