@react-hookz/web
Version:
React hooks done right, for browser and SSR.
18 lines (17 loc) • 1.12 kB
TypeScript
import { IHookReturn, IUseStorageValueOptions } from '../useStorageValue/useStorageValue';
interface IUseLocalStorageValue {
<T = unknown>(key: string, defaultValue?: null, options?: IUseStorageValueOptions): IHookReturn<T, typeof defaultValue, IUseStorageValueOptions<true | undefined>>;
<T = unknown>(key: string, defaultValue: null, options: IUseStorageValueOptions<false>): IHookReturn<T, typeof defaultValue, typeof options>;
<T>(key: string, defaultValue: T, options?: IUseStorageValueOptions): IHookReturn<T, typeof defaultValue, IUseStorageValueOptions<true | undefined>>;
<T>(key: string, defaultValue: T, options: IUseStorageValueOptions<false>): IHookReturn<T, typeof defaultValue, typeof options>;
<T>(key: string, defaultValue?: T | null, options?: IUseStorageValueOptions): IHookReturn<T, typeof defaultValue, typeof options>;
}
/**
* Manages a single localStorage key.
*
* @param key Storage key to manage
* @param defaultValue Default value to yield in case the key is not in storage
* @param options
*/
export declare const useLocalStorageValue: IUseLocalStorageValue;
export {};