use-localstorage-hook
v1.0.1
Published
A custom React hook that lets you sync with localStorage and helps you manipulate objects via built-in JSON.stringify helpers.
Downloads
124
Readme
use-localstorage-hook
A custom React hook that lets you sync with localStorage
and helps you manipulate objects via built-in JSON.stringify
helpers.
Quick Start
Start with:
npm install --save use-localstorage-hook
And in your component use the hook like this:
[ val, setVal ] = useLocalStorage(
'demo',
{ a: 'Hello!' }
);
console.log(val.a)
// => "Hello!"
Docs
The complete documentation as well as a live demo is available here.
License
MIT © filipdanic