2.0.0 • Published 6 years ago

react-localstorage-handler v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-localstorage-handler

Build Status

Scrutinizer Code Quality

Build Status

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 { checkStorage } from 'react-localstorage-handler';

//and then use like so

const status = checkStorage('token');

return status; //will return  true is value exsist and false  if it doesn't

To Add key and value to LocalStorage addStorage()
//import the checkStorage into your project

import { addStorage } from 'react-localstorage-handler';

//and then use like so

 addStorage('token', '$39876756453');

 

To Retrieve a value by the key from LocalStorage getStorage()
//import the checkStorage into your project

import { getStorage } from 'react-localstorage-handler';

//and then use like so

 getStorage('token');

 

To Remove an item by key from LocalStorage removeStorage()
//import the checkStorage into your project

import { removeStorage } from 'react-localstorage-handler';

//and then use like so

 removeStorage('token');

 

To Clear all LocalStorage clearStorage()
//import the checkStorage into your project

import { clearStorage } from 'react-localstorage-handler';

//and then use like so

 clearStorage();

 

Props

all React-localStorage-handler

NameUse
checkStoragecheck is a key is saved in local storage
addStorageAdd key and value to LocalStorage
getStorageRetrieve a value by the key from LocalStorage
removeStorageRemove an item by key from LocalStorage
clearStorageClear all LocalStorage for that domain

Contributing

Feel free to contribute, just send a pull request ;)

Licensing

This project is licensed under MIT license.

2.0.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago