# TypeError: Cannot read properties of null (reading 'useCallback')

- **ID:** `react/cannot-read-properties-of-null-reading-usecallback`
- **Domain:** react
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| React 18.2.0 | active | — | — |
| React 19.0.0 | active | — | — |
| Webpack 5.88.0 | active | — | — |
| Node 20.11.0 | active | — | — |

## Workarounds

1. **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.** (85% success)
   ```
   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.
   ```
2. **If using webpack, add an alias for 'react' in webpack.config.js: `resolve: { alias: { react: path.resolve('./node_modules/react') } }` to force correct resolution.** (80% success)
   ```
   If using webpack, add an alias for 'react' in webpack.config.js: `resolve: { alias: { react: path.resolve('./node_modules/react') } }` to force correct resolution.
   ```
3. **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.** (90% success)
   ```
   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.
   ```

## Dead Ends

- **** — The error is about React object being null, not strict mode. (95% fail)
- **** — The issue is with module resolution, not JSX structure. (90% fail)
- **** — The error stems from bundler misconfiguration, not corrupted packages. (80% fail)
