import { type DependencyList } from "react"; type Effect = (shouldContinueEffect: () => boolean) => Promise; type CleanupFunction = (result: T | void) => void; /** * A version of useEffect that accepts an async function * * @param {Effect} effect Async function that can return a cleanup function and takes in an AbortSignal * @param {DependencyList} deps If present, effect will only activate if the values in the list change * @param {CleanupFunction} cleanup The destroy/cleanup function. Will be called with previous result if it exists. * @see https://rooks.vercel.app/docs/hooks/useAsyncEffect * @example * ```jsx * useAsyncEffect( async (shouldContinueEffect) => { const data1 = await fetchData1(arg1, arg2); if(shouldContinueEffect()) { const data2 = await fetchData2(arg1, arg2); } ... }, [arg1, arg2], (previousResult) => { // ... do something with previousResult ... } ); * ``` */ declare function useAsyncEffect(effect: Effect, deps: DependencyList, cleanup?: CleanupFunction): void; export { useAsyncEffect };