react-idb-toolkit
Version:
⚛️ Elegant and easy-to-use React toolkit for managing local data with IndexedDB, powered by [idb](https://github.com/jakearchibald/idb).
13 lines (12 loc) • 478 B
TypeScript
/// <reference types="react" />
export interface UseIndexedDBStateOptions<T> {
storeName: string;
key: IDBValidKey;
defaultValue?: T | (() => T);
onError?: (error: Error) => void;
}
export declare function useIndexedDBState<T>(options: UseIndexedDBStateOptions<T>): readonly [T, import("react").Dispatch<import("react").SetStateAction<T>>, {
readonly loading: boolean;
/** 手动同步最新数据库状态 */
readonly sync: () => Promise<void>;
}];