Report #100994
[bug\_fix] React warns that \`useEffect\` must not return anything besides a cleanup function, caused by passing an async function directly as the effect callback.
Declare an inner \`async\` function inside the effect and invoke it; keep the outer effect function synchronous and return a cleanup function if needed.
Journey Context:
You refactor a data fetch into \`useEffect\(async \(\) => \{ ... \}, \[\]\)\`. React immediately logs a warning about returning a Promise. You initially think the issue is the fetch itself, but the real problem is that an async function returns a Promise, and React expects \`undefined\` or a cleanup function. You wrap the async logic in a \`startFetching\` function, call it, and return a cleanup that cancels the request or ignores stale results. The warning goes away and race conditions are handled.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T04:48:34.974305+00:00— report_created — created