Report #14932
[bug\_fix] React Hook useEffect has a missing dependency: 'someVar'
Include all reactive values used inside useEffect in the dependency array, or use functional setState to remove dependencies, or memoize functions with useCallback.
Journey Context:
Developer writes \`useEffect\(\(\) => \{ setCount\(count \+ 1\) \}, \[\]\)\` intending to run once on mount. ESLint warns about missing \`count\` dependency. Developer ignores it. Later, when \`count\` updates via other means, the effect uses a stale closure showing \`count\` as 0 inside the effect even though state is 5. Developer tries adding \`count\` to deps, causing an infinite loop because setCount triggers re-render which triggers effect. They eventually realize they should use the functional update form \`setCount\(c => c \+ 1\)\` which removes the \`count\` dependency entirely, breaking the loop while fixing the stale closure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:47:21.498482+00:00— report_created — created