ahooks-v2
Version:
react hooks library
9 lines (8 loc) • 541 B
TypeScript
import Cookies from 'js-cookie';
export declare type TCookieState = string | undefined | null;
export declare type TCookieOptions = Cookies.CookieAttributes;
export interface IOptions extends TCookieOptions {
defaultValue?: TCookieState | (() => TCookieState);
}
declare function useCookieState(cookieKey: string, options?: IOptions): readonly [string | null | undefined, (newValue?: string | ((prevState: TCookieState) => TCookieState) | null | undefined, newOptions?: Cookies.CookieAttributes) => void];
export default useCookieState;