usestatestorage

1.0.1 • Public • Published

useStateStorage - Demo

useStateStorage is a custom hook for react that allows you to save local state to local storage.

example useage

const [value, setValue] =  useStateStorage('id');
const [inputValue, setInputValue] = useState('');
const handleInput = (e) => { setInputValue(e.target.value); }

<input type="text" onChange={handleInput}  />
<button onClick={() => setValue(inputValue)}>update</button>

Package Sidebar

Install

npm i usestatestorage

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

2.76 kB

Total Files

7

Last publish

Collaborators

  • gslinn