Package Exports
- use-react-localstorage-hook
- use-react-localstorage-hook/src/useLocalStorage.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-react-localstorage-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
use-react-localstorage-hook
A React hook to easily manage local storage.
Installation
npm install use-react-localstorage-hook
Usage
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.