import * as React from 'react'; import { Codec } from "./codec.js"; export type StorageStateInitializer = () => T | null; export type UseStorageStateHookResult = [T | null, React.Dispatch>]; export declare function useStorageStateServer(): UseStorageStateHookResult; export interface DefaultStorageStateoptions { codec?: Codec; } export interface StorageStateOptions extends DefaultStorageStateoptions { codec: Codec; } /** * Sync state to local storage so that it persists through a page refresh. Usage is * similar to useState except we pass in a storage key so that we can default * to that value on page load instead of the specified initial value. * * Since the storage API isn't available in server-rendering environments, we * return null during SSR and hydration. */ export declare function useStorageState(area: Storage, key: string | null, initializer?: string | null | StorageStateInitializer, options?: DefaultStorageStateoptions): UseStorageStateHookResult; export declare function useStorageState(area: Storage, key: string | null, initializer: T | null | StorageStateInitializer, options: StorageStateOptions): UseStorageStateHookResult; export interface UseStorageState { /** * Sync state to local or session storage so that it persists through a page refresh. Usage is * similar to useState except we pass in a storage key that uniquely identifies the value. * @param key The key to use for storing the value in local or session storage. * @param initializer The initial value to use if the key is not present in storage. * @param options Additional options for the storage state. */ (key: string | null, initializer?: string | null | StorageStateInitializer, options?: DefaultStorageStateoptions): UseStorageStateHookResult; /** * Sync state to local or session storage so that it persists through a page refresh. Usage is * similar to useState except we pass in a storage key that uniquely identifies the value. * @param key The key to use for storing the value in local or session storage. * @param initializer The initial value to use if the key is not present in storage. * @param options Additional options for the storage state. */ (key: string | null, initializer: T | null | StorageStateInitializer, options: StorageStateOptions): UseStorageStateHookResult; /** * Sync state to local or session storage so that it persists through a page refresh. Usage is * similar to useState except we pass in a storage key that uniquely identifies the value. * @param key The key to use for storing the value in local or session storage. * @param initializer The initial value to use if the key is not present in storage. * @param options Additional options for the storage state. */ (key: string | null, initializer?: T | null | StorageStateInitializer, options?: StorageStateOptions): UseStorageStateHookResult; }