{
  "id": "react/forwardref-children-prop-warning",
  "signature": "Warning: forwardRef render functions accept exactly two parameters: props and ref. Did you mean to pass a ref?",
  "signature_zh": "警告：forwardRef 渲染函数只接受两个参数：props 和 ref。您是否打算传递一个 ref？",
  "regex": "Warning: forwardRef render functions accept exactly two parameters: props and ref",
  "domain": "react",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A component wrapped in React.forwardRef is receiving more than two arguments (e.g., props, ref, and an extra third argument like children) in its render function, which violates the forwardRef signature.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 React.forwardRef 包装的组件在其渲染函数中接收了超过两个参数（例如 props、ref 和额外的第三个参数如 children），这违反了 forwardRef 的签名。",
  "versions": [
    {
      "version": "react@18.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "react@17.0.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a third parameter to the forwardRef render function to accept children explicitly",
      "why_fails": "React.forwardRef only provides two arguments; any extra parameter will be undefined and the warning persists.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrapping the component in another HOC that passes children as a separate prop",
      "why_fails": "The underlying forwardRef still receives the extra argument; the warning is about the render function signature, not prop structure.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring the warning as it doesn't break the app immediately",
      "why_fails": "The warning indicates potential ref forwarding issues that can cause bugs with focus management or third-party libraries.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Change the forwardRef render function to accept exactly two parameters: props and ref. Access children via props.children.",
      "success_rate": 0.9,
      "how": "Change the forwardRef render function to accept exactly two parameters: props and ref. Access children via props.children.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using TypeScript, ensure the forwardRef type signature matches: React.forwardRef<RefType, PropsType>((props, ref) => ...)",
      "success_rate": 0.85,
      "how": "If using TypeScript, ensure the forwardRef type signature matches: React.forwardRef<RefType, PropsType>((props, ref) => ...)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Change the forwardRef render function to accept exactly two parameters: props and ref. Access children via props.children.",
    "If using TypeScript, ensure the forwardRef type signature matches: React.forwardRef<RefType, PropsType>((props, ref) => ...)"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://react.dev/reference/react/forwardRef",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}