use-localstorage-hook

1.0.1 • Public • Published

NPM

use-localstorage-hook

A custom React hook that lets you sync with localStorage and helps you manipulate objects via built-in JSON.stringify helpers.

👉 Demo site and docs.

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

Readme

Keywords

none

Package Sidebar

Install

npm i use-localstorage-hook

Weekly Downloads

43

Version

1.0.1

License

MIT

Unpacked Size

11.2 kB

Total Files

7

Last publish

Collaborators

  • filipdanic