@navinc/base-react-components
Version:
Nav's Pattern Library
13 lines (12 loc) • 465 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
/**
* @see https://github.com/streamich/react-use/blob/master/src/useLocalStorage.ts
*/
export type ParserOptions<T> = {
raw: true;
} | {
raw: false;
serializer: (value: T) => string;
deserializer: (value: string) => T;
};
export declare const useLocalStorage: <T>(key: string, initialValue?: T, options?: ParserOptions<T>) => [T | undefined, Dispatch<SetStateAction<T | undefined>>, () => void];