piral-hooks-utils
Version:
Hooks and HOC for pilets and Piral instances.
8 lines (7 loc) • 398 B
TypeScript
/**
* Gives a full async lifecycle in a hook.
* @param action The lazy loader.
* @param resolve The resolve function getting the result from the promise.
* @returns The current executing state, and the trigger to start the async operation.
*/
export declare function useAsyncReplace<T = void>(action: () => Promise<T>, resolve?: (result: T) => void): [boolean, () => void, Error | undefined];