Hook traps: UseEffect and Stale Closures
I really like hooks: It has an elegant API that is simple to use, declarative, easy to abstract & Reuse. But still, you can get yourself in a trap in some cases: Stale closures are an example. They happen when your useEffect or other hook is seeing older versions of your props and state, usually when you're doing something asynchronous (like an event or a timer). In this video, I show three examples of stale closures and how to deal with them properly using: • The useEffect's dependency array • useState setter in a functional format • using a ref instead of a piece of state

▶︎
Why "Stale Closure" Misleads React Devs

▶︎
Custom State Machine Hook with useReducer & useEffect

▶︎
JavaScript Closures Tutorial (Explained in depth)

▶︎
Mastering React's useEffect

▶︎
All 12 useState & useEffect Mistakes Junior React Developers Still Make in 2026

▶︎
Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

▶︎
Understanding Rust Closures aka. Anonymous Functions 🦀 💻

▶︎
Fantastic closures and how to find them in React

▶︎
Understanding React's UI Rendering Process

▶︎
ReactCasts #11 - Recompose (Deprecated)

▶︎
Learn useState In 15 Minutes - React Hooks Explained

▶︎
Common React Mistakes: useEffect - Part 2

▶︎
Learn React Hooks: useMemo - Simply Explained!

▶︎
Asynchronous tasks inside React.useEffect can create Stale Closure BUGS!

▶︎
Goodbye, useEffect - David Khourshid

▶︎
Can Swyx recreate React Hooks and useState in under 30 min? - JSConf.Asia

▶︎
Mastering React Memo

▶︎
Learn React Hooks: useEffect - Simply Explained!

▶︎
ReactCasts #9 - Immutability in JavaScript

▶︎
