React Hook for Cookies based on js-cookie
npm install @use-hook/use-cookie --save
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>
);
}