Warning: Invalid DOM property `class`. Did you mean `className`?
HTML attribute names were used in JSX instead of their React/DOM property names.
Invalid DOM propertyDid you mean `className`Unknown event handler property Meaning
JSX uses DOM property names: className, htmlFor, tabIndex, readOnly, onClick (camelCase events), style objects. Pasted HTML often keeps class/for/onclick strings.
Common causes
- class instead of className
- for instead of htmlFor
- onclick="..." strings instead of onClick={fn}
- style as a string
⚡ Quick fix
- Rename attributes (className, htmlFor)
- Use camelCase event handlers
- Pass style as an object
Detailed fix by platform
React
<label htmlFor="email" className="label" style={{ color: 'red' }} />
How to diagnose
- Attribute — Which one is named?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- [Vue warn]: Failed to locate Teleport target with selector Vue: [Vue warn]: Failed to locate Teleport target with selector "#modal". Note the target element must exist before the component is mounted
- Adjacent JSX elements Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
- Functions not valid as child Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render.
Most viewed in React
- No QueryClient set Error: No QueryClient set, use QueryClientProvider to set one
- Functions cannot be passed Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server".
- next/image hostname Error: Invalid src prop on `next/image`, hostname "x" is not configured under images in your `next.config.js`
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026