use-localstorage-sync
v0.1.3
Published
React hooks api to synchronize localstorage as a state across browser tabs
Downloads
301
Readme
React Localstorage Sync
React hooks api to synchronize localstorage as a state across browser tabs
Start with
yarn add use-localstorage-sync
and can be used as a state hook in any React component
+ import useLocalStorage from "use-localstorage-sync";
+ const [value, setValue] = useLocalStorage("key");
Similar to the useState hook, the value
in the associated key is updated in localstorage, it is updated. Similarly, the setValue
updates the state in all associated browser tabs simulataneously.