{
  "id": "react/invalid-array-children-map",
  "signature": "TypeError: X is not a function. (In 'X()', 'X' is undefined) when using .map on children",
  "signature_zh": "类型错误：X 不是一个函数。（在 'X()' 中，'X' 未定义）当对 children 使用 .map 时",
  "regex": "TypeError: ([a-zA-Z_$][a-zA-Z0-9_$]*) is not a function\\. \\(In '\\1\\(\\)', '\\1' is undefined\\)",
  "domain": "react",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The 'children' prop is not an array but a single React element, string, or undefined, so calling .map() on it fails.",
  "root_cause_type": "generic",
  "root_cause_zh": "children 属性不是一个数组，而是一个单独的 React 元素、字符串或 undefined，因此对其调用 .map() 会失败。",
  "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": "",
      "why_fails": "If children is already an array (multiple children), this creates a nested array; .map won't iterate over individual children correctly.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "React.Children.toArray returns an empty array for null/undefined, so .map works, but the real issue is that children might be a single element not in an array, which toArray handles but the user may not realize why.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use React.Children.toArray(children) before calling .map() to safely convert children to an array, regardless of type.",
      "success_rate": 0.95,
      "how": "Use React.Children.toArray(children) before calling .map() to safely convert children to an array, regardless of type.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a guard to check if children is an array before mapping. If not, wrap it in an array or handle single child separately.",
      "success_rate": 0.9,
      "how": "Add a guard to check if children is an array before mapping. If not, wrap it in an array or handle single child separately.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use React.Children.toArray(children) before calling .map() to safely convert children to an array, regardless of type.",
    "Add a guard to check if children is an array before mapping. If not, wrap it in an array or handle single child separately."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://react.dev/reference/react/Children#children-map",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.93,
  "resolvable": "true",
  "first_seen": "2023-06-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}