Chapter 10 · Example 3 · Closures in React
useCallback dependencies
A useCallback with an empty dependency array never refreshes its closure, so the state read inside the callback stays stuck at its initial value.
Loading live editor…
Chapter 10 · Example 3 · Closures in React
A useCallback with an empty dependency array never refreshes its closure, so the state read inside the callback stays stuck at its initial value.