UNPKG

use-cookie-state

Version:

State management React hook using browser cookies as persistent storage

10 lines (9 loc) 350 B
import * as cookie from "cookie"; export type Encode = cookie.SerializeOptions; export type Decode = (value: string) => any; type Options = { decode?: Decode; encode?: Encode; }; export declare function useCookieState<T = string>(key: string, initialValue: T, options?: Options): [T, (value: T, encode?: Encode) => void]; export {};