useCookies ​
Hook that manages cookie values
browser
test coverage
Last changed: 5 days ago
Installation ​
Library
CLI
Manual
typescript
import { useCookies } from '@siberiacancode/reactuse';
Usage ​
typescript
const { value, set, remove, getAll, clear } = useCookies();
Demo ​
Api ​
Returns
UseCookieReturn<Value>
Type declaration ​
typescript
import type { RemoveCookieParams, SetCookieParams } from '../useCookie/useCookie';
export type CookieParams = Record<string, any>;
export interface UseCookiesOptions<Value> {
/* The deserializer function to be invoked */
deserializer?: (value: string) => Value[keyof Value];
/* The serializer function to be invoked */
serializer?: (value: Value[keyof Value]) => string;
}
Source ​
Source • DemoContributors ​
D
B