New
Introducing React Bench, see how different models perform on React code

react-doctor/exhaustive-deps

Match the deps array to what the hook callback actually captures, or stabilize/move recreated values instead of blindly adding them.

Validate the diagnostic

Confirm the reported code matches this rule before you edit it.

Fires on useEffect, useLayoutEffect, useInsertionEffect, useCallback, useMemo, useImperativeHandle, and configured additional hooks when the dependency array omits a reactive capture or contains an invalid dependency. Effects may intentionally omit the array, and unused reactive effect dependencies are allowed. useMemo and useCallback require dependency arrays and report unused dependencies. All supported hooks report duplicates, spreads, literals, computed members, ref.current, useEffectEvent, inline-recreated values, and outer-variable assignments. Stable setters, dispatch, startTransition, ref bindings, effect-event handlers, module imports, and primitive local constants do not need dependencies.

How to fix

Follow the rule guidance while preserving unrelated behavior.

Copyable fix prompt

Copy this self-contained prompt into your coding agent after you confirm the diagnostic.

Add every reactive capture when you provide a dependency array. Keep the required arrays on useMemo and useCallback; an effect may intentionally run after every render without one. Move recreated values into the callback or stabilize them before adding them. Use functional state updates to remove captured state, depend on the ref instead of ref.current, and avoid spreads or computed expressions. Add a narrow suppression with a written reason only when exclusion is intentional. See https://oxc.rs/docs/guide/usage/linter/rules/react/exhaustive-deps

More Bugs rules from the rules reference: