1.2.5 • Published 5 years ago
react-use-localstorage-hook v1.2.5
react-use-localstorage-hook
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)}
/>
</>
);
}