1.2.5 • Published 5 years ago

react-use-localstorage-hook v1.2.5

Weekly downloads
20
License
MIT
Repository
github
Last release
5 years ago

react-use-localstorage-hook npm version

Simple localstorage hook with sharing states across components, tabs, windows

npm i react-use-localstorage-hook

Example of code:

import useLocalStorage from "react-use-localstorage-hook";

function Input() {
  const [value, setValue] = useLocalStorage("test:input", "input text");

  return (
    <>
      <div>{value}</div>
      <input
        value={value}
        onInput={({ target: { value } }) => setValue(value)}
      />
    </>
  );
}

Advanced example in this demo:
Edit React useLocalStorage hook