Create, read, or delete cookies (mmmm...cookie)
cookieName: String
: Name of cookieinitialValue?: String
: First value of cookie
cookieValue: String
: Current value of the cookieupdateCookie: Function(value: String, days = 365, path = '/')
: Set a new value of the cookiedeleteCookie: Function(path = '/')
: Bye bye cookie
import { useCookie } from "react-recipes";
const App = () => {
const [userToken, setUserToken, deleteUserToken] = useCookie('token', '0');
render(
<div>
<p>{userToken}</p>
<button onClick={() => setUserToken('123')}>Change token</button>
<button onClick={() => deleteUserToken()}>Delete token</button>
</div>
);
};