A React hook to easily manage local storage.
npm install use-react-localstorage-hook
import React from 'react';
import useLocalStorage from 'use-react-localstorage-hook';
const App = () => {
const [name, setName] = useLocalStorage('name', 'John Doe');
return (
<div>
<h1>Hello, {name}!</h1>
<input
type="text"
value={name}
=> setName(e.target.value)}
/>
</div>
);
};
export default App;
This project is licensed under the MIT License. See the LICENSE file for details.