README
useCookie - React Hook
React Hook for Cookies based on js-cookie
Instalation
npm install @use-hook/use-cookie --save
Usage
import { useCookie } from "@use-hook/use-cookie";
function App() {
const [name, setName] = useCookie("name", "Stefan");
return (
<div>
<input
type="text"
placeholder="Provide your name"
value={name}
onChange={e => setName(e.target.value, { expires: 1 })}
/>
</div>
);
}