foxact
Version:
React Hooks/Utils done right. For browser, SSR, and React Server Components.
11 lines (8 loc) • 769 B
TypeScript
import { NotUndefined, UseStorageRawOption, UseStorageParserOption, StateHookTuple, Serializer } from '../create-storage-hook/index.js';
export { Deserializer } from '../create-storage-hook/index.js';
declare const useLocalStorage: {
<T>(key: string, serverValue: NotUndefined<T>, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T>;
<T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): StateHookTuple<T | null>;
};
declare const useSetLocalStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
export { Serializer, UseStorageParserOption as UseLocalStorageParserOption, UseStorageRawOption as UseLocalStorageRawOption, useLocalStorage, useSetLocalStorage };