arrow_backBACK TO DRILLS
Blue BeltuseeffectlockPREMIUM

Async Function Passed Directly to useEffect Returns a Promise Not a Cleanup Function

A developer wants an effect to fetch data and clean up an in-flight request on unmount.

REACT_MODULE // 0x42
useEffect(async () => {
const controller = new AbortController();
const data = await fetchData({ signal: controller.signal });
setData(data);
return () => controller.abort();
}, []);

Why does the cleanup function returned from this effect never actually run?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.