0.5.1 • Published 3 years ago

react-use-storage v0.5.1

Weekly downloads
272
License
UNLICENSE
Repository
github
Last release
3 years ago

react-use-storage

React Hook to handle local and session storage


Install

npm install --save react-use-storage

Usage

See this hooks as a useState hooks that syncs with local/session storage.

☝️ NOTE: if the value of the key in the storage change from another portion of your code, the hook keep it in sync and re-render your component with the new value.

LocalStorage

	import {useLocalStorage} from "react-use-storage";

	// ...
		const [value, setValue, removeValue] = useLocalStorage("key", "default value");

SessionStorage

	import {useSessionStorage} from "react-use-storage";

	// ...
		const [value, setValue, removeValue] = useSessionStorage("key", "default value");

License

UNLICENSED (public domain)

0.4.4

3 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago