UNPKG

rooks

Version:

Essential React custom hooks ⚓ to super charge your components!

15 lines 474 B
/** * usePromise * @description Promise management hook for react * @see {@link https://rooks.vercel.app/docs/usePromise} */ import { DependencyList } from "react"; type AsyncFunction<T> = () => Promise<T>; type PromiseState<T> = { data: T | null; loading: boolean; error: Error | null; }; declare function usePromise<T>(asyncFunction: AsyncFunction<T>, deps?: DependencyList): PromiseState<T>; export { usePromise }; //# sourceMappingURL=usePromise.d.ts.map