useCookie
cookie](https://developer.Installation
npx sse-tool add use-cookie
npm install sse-hooks
Usage
import { useCookie } from "./{hooks file}";
// Creates a cookie named "__Secure-token"
const [token, setToken] = useCookie("token", "", {
prefix: "__Secure-",
secure: true,
});
import { useCookie } from "sse-hooks";
// Creates a cookie named "__Secure-token"
const [token, setToken] = useCookie("token", "", {
prefix: "__Secure-",
secure: true,
});
API
Parameters
| Name | Type | Description |
| :----------- | :----------------- | :--------------------------- | ------------------------------- |
| key | string | The base name of the cookie. |
| initialValue | T | Function | The initial value of the state. |
| options | UseCookieOptions | Options for customization. |
Return Value
Returns any.
A tuple containing the stored value, a setter, and a remover.
Changelog
81e9f — feat: update documentation and categorize hooks
c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation
30da4 — feat: add new hooks and their metadata
cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size