Runs an async effect with cancellation support.
The async effect function.
Optional
The dependency array.
The effect function receives an AbortSignal. The signal is aborted when the effect cleans up (e.g., component unmounts or deps change).
AbortSignal
useAsyncEffect(async (signal) => { await fetchData({ signal });}, [id]); Copy
useAsyncEffect(async (signal) => { await fetchData({ signal });}, [id]);
Runs an async effect with cancellation support.