React Signals' Dirty Secrets: Stale Closures, Leaks, and Why They're Not Magic Bullets
React devs hoped Signals would end stale state woes forever. Reality? They're powerful, but riddled with pitfalls like outdated closures in timeouts that demand precise handling.
theAIcatchupApr 10, 20263 min read
⚡ Key Takeaways
Stale closures in timeouts? Always peek() for fresh values—no tracking needed.𝕏
Stabilize Signals with useSignalState/useComputed to kill recreation leaks.𝕏
Computed tracks .get() only—snapshots don't count; unify with useSyncExternalStore for tear-free wins.𝕏
The 60-Second TL;DR
Stale closures in timeouts? Always peek() for fresh values—no tracking needed.
Stabilize Signals with useSignalState/useComputed to kill recreation leaks.
Computed tracks .get() only—snapshots don't count; unify with useSyncExternalStore for tear-free wins.