Interview Q&A / System Design
System Design interview questions
Caching, scaling, databases and classic design problems for beginners.
Prefer rapid revision? Practise System Design short interview answers →
- What is a stale closure in a React effect, and how do you fix it?
A closure captures the values from the render where it was created. An effect with a missing dependency keeps using old values. Fix it by listing the dependency, using the updater form of setState, or storing the latest value in a ref.
IntermediateQuick answer1 min read