Warning: React does not recognize a prop on a DOM element
Warning: React does not recognize the `isActive` prop on a DOM element.Short answer
React shows this warning when a prop reaches a real HTML element that does not understand it. The usual cause is spreading all props onto a div or button, including ones meant for your own component. Pull those props out before spreading the rest, use data-* for custom data, and name components in PascalCase.
Fix it fast
1Find out which cause you have
The warning names the prop. Search your code for where that prop is passed down, and check whether a {...props} spread sits between it and a DOM tag.
grep -rn "{\.\.\.props}\|{\.\.\.rest}" src/2Match what you see, then jump to its fix
- 1
The named prop is one your own component uses, such as layout or isActiveProps are spread onto a DOM element along with parent-only propsFix - 2
The prop is something you invented on a plain tag, for example <div layout="horizontal">A non-standard attribute is used to store custom dataFix - 3
The warning appears on a tag you thought was your own component, such as <myButton>A component name starts with a lowercase letterFix
- 1
What does the error look like?
Warning: React does not recognize the `isActive` prop on a DOM element.Warning: Unknown event handler propertyWarning: Received `true` for a non-boolean attribute
Cause 1 of 3
Props are spread onto a DOM element along with parent-only props
1Check
Find the component whose JSX has {...props} on a div, button or similar. Any prop the parent set, but the element does not know, is forwarded.
grep -n "<div {...props}\|<button {...props}" -r src/2Fix
Destructure the props your component uses and spread only the remainder onto the element.
function MyDiv(props) {
const { layout, ...rest } = props;
const style = layout === 'horizontal' ? getHorizontalStyle() : getVerticalStyle();
return <div {...rest} style={style} />;
}3Verify
Reload the page and confirm the warning is gone from the console.
npm run devConfirmed by react.dev
Cause 2 of 3
A non-standard attribute is used to store custom data
1Check
Search the markup for attributes that are not standard HTML or React DOM props.
grep -rn "<div [a-z]*=" src/ | head2Fix
Use a data-* attribute for custom data. React documents that custom attribute names must be lowercase and must not start with on.
// before
<div layout="horizontal" />
// after
<div data-layout="horizontal" />3Verify
Reload and check that the warning no longer lists the attribute.
npm run devConfirmed by react.dev
Cause 3 of 3
A component name starts with a lowercase letter
1Check
JSX treats lowercase tag names as DOM tags, so the props of <myButton /> are checked against HTML.
grep -rn "<[a-z][A-Za-z]*[A-Z]" src/ --include=*.jsx --include=*.tsx2Fix
Rename the component and every use of it in PascalCase.
// wrong: rendered as a DOM tag
<myButton />
// right
<MyButton />3Verify
The warning is gone and the component renders its own markup.
npm run devConfirmed by react.dev
How do I stop it coming back?
- Never spread props onto a DOM element without first removing the props your own component consumes.
- Use camelCase DOM names (className, htmlFor, tabIndex) and lowercase names for custom attributes.
- Keep custom data in data-* attributes, or in props and state.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
ESLint says an element in a list is missing its key prop
react/jsx-key
react/jsx-key fires when an element returned from map, Array.from or an array literal has no key.
3 causes, each with a fixWeb apps
There is no tailwind.config.js after installing Tailwind 4 and HeroUI in Next.js
HeroUI components render unstyled
Nothing is broken: Tailwind CSS 4 is configured in CSS and no longer creates tailwind.config.js.
3 causes, each with a fixWeb apps
react-i18next shows the wrong plural form for a count, or prints the key instead of the text
t('item') prints the key item instead of a translated sentence
i18next picks a plural from the count option and looks for keys ending in _one, _other and so on.
4 causes, each with a fixWeb apps
useSession throws because there is no SessionProvider above it
[next-auth]: `useSession` must be wrapped in a <SessionProvider />
useSession reads the session from React Context, and SessionProvider is what creates that context.
3 causes, each with a fixWeb apps
next/link throws React.Children.only on its children
Error: React.Children.only expected to receive a single React element child.
React.Children.only accepts exactly one React element and throws for anything else, including an array with one item.
3 causes, each with a fixWeb apps
Hydration failed after adding next-themes dark mode
Console reports a server and client mismatch on the html element
next-themes changes the html element and knows the theme only in the browser, so server HTML and client HTML differ.
3 causes, each with a fix