use-react-localstorage-hook
v1.0.7
Published
A React hook to easily manage local storage.
Maintainers
Readme
use-react-localstorage-hook
A React hook to easily manage local storage.
Installation
npm install use-react-localstorage-hookUsage
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}
onChange={(e) => setName(e.target.value)}
/>
</div>
);
};
export default App;Demo
License
This project is licensed under the MIT License. See the LICENSE file for details.
