Stale Closures in React: Why useState Gives You the Wrong Value

A stale closure captures state from a previous render and never lets go. It is the most common useState bug, and understanding why it happens makes it impossible to miss.

June 7, 20261 min read2 / 3