Skip to main content
React Interview Questions Theory P0 Medium

Effects, dependencies and cleanup

Compare an omitted dependency list, [], and [id]. When should cleanup run?

Official Reference

Model Answer & Explanation

An omitted list lets the effect run after every commit of the component. [] represents no reactive dependencies. [id] runs on mount and then when id changes by Object.is comparison. React cleans up the old setup before re-running it with new dependencies, and on unmount. Root Strict Mode adds a development-only setup/cleanup check.

Follow-up Interview Question · What causes an object created during render to retrigger an effect?

Module Context & References

React · Rendering & hooks theory Explain renders, reconciliation, keys, state, effects and performance
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.