{
  "id": "react/missing-exhaustive-deps",
  "signature": "React Hook useEffect has a missing dependency: 'variable'. Either include it or remove the dependency array.",
  "signature_zh": "React Hook useEffect缺少依赖项：'variable'。要么包含它，要么删除依赖项数组。",
  "regex": "React Hook useEffect has a missing dependency: '.*'",
  "domain": "react",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The exhaustive-deps ESLint rule detects that a variable used inside useEffect is not listed in its dependency array, potentially leading to stale closures or missed updates.",
  "root_cause_type": "generic",
  "root_cause_zh": "exhaustive-deps ESLint规则检测到在useEffect内部使用的变量未在其依赖项数组中列出，可能导致过时闭包或错过更新。",
  "versions": [
    {
      "version": "eslint-plugin-react-hooks 4.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "React 18.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding // eslint-disable-next-line react-hooks/exhaustive-deps without understanding the dependency",
      "why_fails": "Suppressing the warning does not fix the underlying stale closure bug; it only hides the lint error.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing the dependency array entirely ([] to undefined)",
      "why_fails": "Without a dependency array, the effect runs after every render, which can cause performance issues and infinite loops if it updates state.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using useRef to store the variable and reading from ref inside the effect",
      "why_fails": "This works but is often unnecessary and can be confusing; it also bypasses the reactive nature of the variable.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add the missing variable to the dependency array. If the variable is a function, wrap it in useCallback first.",
      "success_rate": 0.9,
      "how": "Add the missing variable to the dependency array. If the variable is a function, wrap it in useCallback first.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the variable is not meant to be reactive (e.g., a stable reference), use useRef to store it and access via .current.",
      "success_rate": 0.85,
      "how": "If the variable is not meant to be reactive (e.g., a stable reference), use useRef to store it and access via .current.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add the missing variable to the dependency array. If the variable is a function, wrap it in useCallback first.",
    "If the variable is not meant to be reactive (e.g., a stable reference), use useRef to store it and access via .current."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://react.dev/reference/react/useEffect#specifying-reactive-dependencies",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-04-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}