UNPKG

tg-use-local-storage-state

Version:
23 lines (22 loc) 692 B
import { Dispatch, SetStateAction } from 'react'; export declare type LocalStorageState<T> = [ T, Dispatch<SetStateAction<T>>, { isPersistent: boolean; removeItem: () => void; } ]; export default function useLocalStorageState(key: string, options?: { ssr: boolean; isSimpleString?: boolean; }): LocalStorageState<unknown>; export default function useLocalStorageState<T>(key: string, options?: { ssr: boolean; isSimpleString?: boolean; }): LocalStorageState<T | undefined>; export default function useLocalStorageState<T>(key: string, options?: { defaultValue?: T; ssr?: boolean; isSimpleString?: boolean; }): LocalStorageState<T>;