When should you NOT use useEffect?
Quick answer
Don't use it to transform data for rendering (derive it instead) or to respond to a user event (do it in the handler).
In detail
Effects are overused. If you can compute a value from existing props/state, do it during render rather than storing it via an effect. If something should happen because the user clicked, put it in the event handler — not in an effect watching state. Reserve effects for synchronising with systems outside React (network, DOM, subscriptions).
// ❌ effect to derive state
useEffect(() => setFull(first + ' ' + last), [first, last]);
// ✅ derive during render
const full = first + ' ' + last;💡The test
Am I syncing with something OUTSIDE React? If not, you probably don't need an effect.
Why interviewers ask this: Signals maturity — knowing when a tool is wrong matters.
This is 1 of 118+ questions in the React Interview Kit
Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.
⚡ Get the React Interview Kit → ₹399