{
  "id": "react/cannot-read-properties-of-null-reading-usecallback",
  "signature": "TypeError: Cannot read properties of null (reading 'useCallback')",
  "signature_zh": "类型错误：无法读取 null 的属性（读取 'useCallback'）",
  "regex": "TypeError: Cannot read properties of null \\(reading 'useCallback'\\)",
  "domain": "react",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "React hooks (like useCallback) are called outside a valid React component or custom hook context, often due to broken module bundling or incorrect import of React.",
  "root_cause_type": "generic",
  "root_cause_zh": "React hooks（如 useCallback）在有效的 React 组件或自定义 Hook 上下文之外被调用，通常是由于模块打包错误或 React 导入不正确。",
  "versions": [
    {
      "version": "React 18.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "React 19.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Webpack 5.88.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Node 20.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is about React object being null, not strict mode.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The issue is with module resolution, not JSX structure.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error stems from bundler misconfiguration, not corrupted packages.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure React is imported correctly at the top of the file: `import React, { useCallback } from 'react';` and check that your bundler (e.g., webpack) resolves 'react' to a valid module.",
      "success_rate": 0.85,
      "how": "Ensure React is imported correctly at the top of the file: `import React, { useCallback } from 'react';` and check that your bundler (e.g., webpack) resolves 'react' to a valid module.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using webpack, add an alias for 'react' in webpack.config.js: `resolve: { alias: { react: path.resolve('./node_modules/react') } }` to force correct resolution.",
      "success_rate": 0.8,
      "how": "If using webpack, add an alias for 'react' in webpack.config.js: `resolve: { alias: { react: path.resolve('./node_modules/react') } }` to force correct resolution.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check for multiple React versions in node_modules (e.g., from hoisting issues). Run `npm ls react` or `yarn why react` and deduplicate using `npm dedupe` or resolutions in package.json.",
      "success_rate": 0.9,
      "how": "Check for multiple React versions in node_modules (e.g., from hoisting issues). Run `npm ls react` or `yarn why react` and deduplicate using `npm dedupe` or resolutions in package.json.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure React is imported correctly at the top of the file: `import React, { useCallback } from 'react';` and check that your bundler (e.g., webpack) resolves 'react' to a valid module.",
    "If using webpack, add an alias for 'react' in webpack.config.js: `resolve: { alias: { react: path.resolve('./node_modules/react') } }` to force correct resolution.",
    "Check for multiple React versions in node_modules (e.g., from hoisting issues). Run `npm ls react` or `yarn why react` and deduplicate using `npm dedupe` or resolutions in package.json."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://react.dev/reference/react/useCallback",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}