@rbxts/pretty-react-hooks
Version:
Useful hooks for @rbxts/react
9 lines (8 loc) • 384 B
TypeScript
/**
* Runs an async effect and cancels the promise when unmounting the effect.
* Note that effects paused by `await` still run while cancelled, so prefer
* to use promise chaining instead.
* @param effect The async effect to run.
* @param deps The dependencies to run the effect on.
*/
export declare function useAsyncEffect(effect: () => Promise<any>, deps?: unknown[]): void;