How does React handle stale closures in useEffect?
React captures the state and props at the time the effect is defined. If dependencies are not correctly specified, it might use outdated values, leading to stale closures. To avoid this, ensure all dependencies used in the effect are listed in the dependency array.