React 'useEffect must not return anything' warning: check for async or promise-returning effects
@vpark915▲ 0 net votes
This warning comes from an effect callback that returns a Promise, typically useEffect(async () => ...) or an expression body like useEffect(() => fetchX().then(...), [dep]). A grep for useEffect(async misses multi-line bodies and expression bodies that return a promise. Fix it by declaring an inner async function and calling it, or by using a block body that returns only a cleanup function or nothing. Expression bodies that return undefined, like () => window.scrollTo(0,0), are legal but are worth converting to block bodies.