React does not recognize the prop on a DOM element
React drops camelCase props it cannot map to an attribute. Destructure before spreading, prefer data-* names, and use transient props in styled-components.

Introduction & Quick Summary
React prints a warning for a prop it will not render:
Warning: React does not recognize the `isActive` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom attribute,
spell it as lowercase `isactive` instead. If you accidentally passed it
from a parent component, remove it from the DOM element.Nothing crashes. The attribute is silently dropped, styling that depended on it looks broken, and the console fills up on every render. The cause is always the same: a prop reached a host element (<div>, <button>, <span>) with a name React does not map to a valid HTML or SVG attribute.
Quick answer: keep your own props out of the DOM node. Destructure them first, or spread only what the element accepts:
function Card({ isActive, children, ...rest }: CardProps) {
return <div className={isActive ? "on" : "off"} {...rest}>{children}</div>;
}React 16 and later forward unknown attributes that are already all-lowercase, so <div customthing="x"> renders and does not warn. What it refuses is a camelCase or otherwise non-standard name, because lowercasing it could collide with a real attribute and change behaviour.
Core Mechanics, Signatures & Reproducible Setup
React keeps a list of valid DOM properties. For an attribute not on that list, the rule is:
- If the name contains an uppercase letter, warn and do not render it.
- If the name is lowercase and not a reserved name, render it verbatim as an attribute.
- If the value is
false, render nothing;truerenders the attribute with an empty value on custom attributes but warns for non-boolean standard ones.
That is the entire mechanism, and it explains every variant of the message, including the sibling warnings Invalid DOM property 'class'. Did you mean 'className'? and Received 'true' for a non-boolean attribute.
A minimal reproduction with no libraries:
export function Badge({ count }: { count: number }) {
return <span badgeCount={count}>new</span>;
}
// Warning: React does not recognize the `badgeCount` prop on a DOM element.
export function BadgeFixed({ count }: { count: number }) {
return <span data-badge-count={count}>new</span>;
}
// renders: <span data-badge-count="3">new</span>The same code path catches typos in real props, which is why the warning is worth fixing rather than filtering: onclick instead of onClick, class instead of className, and tabindex instead of tabIndex all pass the component boundary and land here.
Key Comparison Table
The names people write, and what React expects:
| Written | React expects | Result |
|---|---|---|
class="btn" | className | invalid DOM property warning, attribute dropped |
for="email" | htmlFor | invalid DOM property warning, label breaks |
onclick={fn} | onClick | unknown prop warning, handler never runs |
tabindex="0" | tabIndex | unknown prop warning, focus order breaks |
readonly | readOnly | unknown prop warning on a controlled field |
stroke-width | strokeWidth | valid on SVG only; on div it is forwarded lowercase |
data-id / aria-label | same | forwarded, no warning |
Three warnings that look alike and are not:
| Warning | Cause | Fix |
|---|---|---|
does not recognize the X prop | unknown camelCase prop on a host element | destructure or rename to data-* |
Invalid DOM property 'x'. Did you mean 'y'? | known React name misspelled | use the React spelling |
Received 'true' for a non-boolean attribute | boolean passed to a string attribute | pass the string, or omit when false |
Where the prop usually comes from:
| Source | Typical shape | Clean fix |
|---|---|---|
| component wrapper | {...props} on the inner node | const { custom, ...rest } = props |
| styled-components v6 | $variant transient props | already stripped when prefixed $ |
| MUI / Chakra | sx, ownerState | library filters; do not forward manually |
| react-hook-form | register() spread plus custom prop | spread register fields only |
| custom element | camelCase property | set it via ref or lowercase attribute |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Destructure before the spread, and type it
type ButtonProps = React.ComponentPropsWithoutRef<"button"> & {
isActive?: boolean; // not a DOM attribute
};
export function Button({ isActive = false, className, ...rest }: ButtonProps) {
return <button data-active={isActive} className={className} {...rest} />;
}ComponentPropsWithoutRef<"button"> gives you onClick, disabled, type, and friends with no ref conflict, and it makes any extra required prop visible at the call site instead of at the DOM boundary.
2. Transient props in styled-components v6
Version 6 made transient props strict: a $-prefixed prop is consumed by the styled component and never reaches the DOM.
const Pill = styled.span<{ $tone: "ok" | "warn" }>`
color: ${(p) => (p.$tone === "ok" ? "#0a0" : "#c80")};
`;
<Pill $tone="warn">degraded</Pill> // no warning, no attribute
<Pill tone="warn">degraded</Pill> // warning: tone is not recognisedFor emotion, the equivalent is shouldForwardProp:
const Tag = styled.div.withConfig({
shouldForwardProp: (prop) => prop !== "tone",
})<{ tone: string }>`...`;3. Filtering a whitelist when wrapping a third-party component
When you wrap a component that forwards everything, filter by the element you render:
const DOM_PROPS = new Set(["id", "className", "style", "title", "role", "onClick"]);
function Surface(props: Record<string, unknown>) {
const dom: Record<string, unknown> = {};
for (const [k, v] of Object.entries(props)) if (DOM_PROPS.has(k)) dom[k] = v;
return <section {...dom} />;
}An allow-list ages better than a deny-list, because a new prop added to the component later cannot leak into the DOM silently.
4. Custom elements and camelCase properties
For a web component such as <my-slider>, React 19 sets properties on the element for names it finds on the instance and falls back to attributes otherwise. Passing minValue={5} to a custom element therefore works without a warning, while the same prop on a <div> warns. Do not rely on that on a host element: use a lowercase attribute, a data-* attribute, or a ref:
function Slider({ minValue }: { minValue: number }) {
const ref = React.useRef<HTMLElement>(null);
React.useEffect(() => { if (ref.current) ref.current.minValue = minValue; }, [minValue]);
return React.createElement("my-slider", { ref });
}5. SVG attributes that are legal and look illegal
viewBox, strokeWidth, fillRule, clipPath, stopColor and textAnchor are real camelCase React props and never warn. stroke-width written in JSX is forwarded lowercase and also works on an SVG element, but mixing the two styles in one file makes the warning list unreliable — pick one and stay with it.
6. Booleans and the non-boolean attribute warning
<div aria-hidden={true} /> // fine: aria-* accepts booleans
<div draggable={false} /> // removed from the DOM
<div tabIndex={0} /> // fine: tabIndex is numeric
<a download={true} /> // warns: download is a string attributeUse download="" or download="report.csv", and omit the attribute entirely instead of passing false where the attribute is enumerated.
Common Compilation/Runtime Mistakes & Version Gotchas
Filtering the warning instead of the prop. console.error overrides and suppressHydrationWarning do not remove an attribute; they hide the evidence. If a library is the source, patch the wrapper, not the console.
Double spread. <Card {...props} {...rest} /> where rest still contains the custom key reintroduces it, because JSX merges props left to right and the later object wins.
React 15 habits. React 15 stripped every unknown attribute silently. Code that rendered customprop="x" kept working after the upgrade to 16 but lost the attribute, and only the warning tells you. Audit wrappers written before 2018 for camelCase props that used to do nothing.
Server and client disagree. With SSR the warning can appear once on the server and again on hydration, and React 19 groups repeated warnings, so the count is not evidence of how many components are affected. Fix the first one and reload.
TypeScript does not catch it. React.HTMLAttributes<HTMLDivElement> is an interface with an index signature in older @types/react versions, so isActive type-checks even though React rejects it. ComponentPropsWithoutRef plus a strict exactOptionalPropertyTypes setup catches far more.
Checking what actually rendered. Read the DOM instead of the source when a styling bug follows this warning: the element inspector shows the attribute list, and the JSON formatter is useful when your props come from an API and you want to see which keys were forwarded. The regular expression tester helps when you grep a large repository for spread patterns such as \{\.\.\.props\} to find every wrapper that needs a destructure.
Reference material: React does not recognize the prop and Common components: DOM attributes.
Official references
primary documentationThe React documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit React work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related React guides
All React guidesReact 19: Support for defaultProps will be removed
React 19 ignores defaultProps on function components, so a default becomes undefined. Move defaults into the parameter list and handle null honestly.
React: Each child in a list should have a unique key prop
Keys tell React which item is which between renders. Use stable ids, avoid index keys and put the key on the mapped element, not on a wrapper.
react-hook-form with zod 4: resolver type errors after the upgrade
Zod 4 split input from output and resolvers v5 re-typed Resolver. Drop the generic, or pass all three, and the errors disappear.
React Profiler API: Measuring Render Timings and Identifying Wasted Re-Renders
actualDuration versus baseDuration, phase names that tell you who triggered a commit, and how to ship the numbers without flooding a backend.
More in React
All React guidesThe guides filed next to this one in React, in library order.