A dynamically chosen React component triggers the incorrect casing warning
Your error
<myCard /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.2 more lines it can showFix it fast
Most common cause, 1 of 2The JSX tag or variable starts with a lowercase letter
Give the variable a capitalized name.
// before: const myCard = isCompact ? CompactCard : Card; ... <myCard />
const CardView = isCompact ? CompactCard : Card;
return <CardView title={title} />;Short answer
<myCard /> is using incorrect casing means React got a capitalized string as the element type and tried to create an HTML element by that name. A JSX tag that starts lowercase, or a component name from an API or CMS rendered as a string, causes it. Render a capitalized variable holding the real component. Applies to React 18 and 19.
Which cause do you have?
Search the JSX for tags that start lowercase but contain a capital, then log the value you render in the dynamic spot. A search hit points to cause 1. A value that logs as a string points to cause 2. React 18 prints Warning: in front of the message; React 19 does not.
grep -rnE "<[a-z]+[A-Z][A-Za-z]*[ />]" src/
// right before the JSX that renders the dynamic value:
console.log(typeof Component, Component);Then find the line you see in this list and open its fix:
- 1The JSX tag or variable starts with a lowercase letter
The warning names a camelCase tag such as <myCard />, and that exact name appears in your JSX - 2A component name from data is rendered as a string
typeof Component logs string, for example 'HeroBanner' read from an API response, a CMS block or a JSON layout
What does the error look like?
<myCard /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.Warning: <HeroBanner /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.The tag <HeroBanner> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
Cause 1 of 2
The JSX tag or variable starts with a lowercase letter
You seeThe warning names a camelCase tag such as <myCard />, and that exact name appears in your JSX
Check
<myCard /> is using incorrect casing because JSX tells HTML tags and components apart by the first letter: a lowercase start means an HTML tag, so React tries to build a DOM element called myCard. React DOM then warns, since a tag without a dash is expected to be a known element written in lowercase.
grep -rnE "const [a-z][A-Za-z]* = .*\?" src/Fix
Give the variable a capitalized name. Storing a component in a new variable is fine; only the name you write between the angle brackets must start with a capital letter.
// before: const myCard = isCompact ? CompactCard : Card; ... <myCard />
const CardView = isCompact ? CompactCard : Card;
return <CardView title={title} />;Verify
The warning is gone and the component's own markup shows in the Elements panel instead of a <mycard> tag.
document.querySelectorAll('mycard').length // 0Confirmed by react.dev
Cause 2 of 2
A component name from data is rendered as a string
You seetypeof Component logs string, for example 'HeroBanner' read from an API response, a CMS block or a JSON layout
Check
When the value used as the tag is a string, React treats it as an HTML tag name, capitals or not. A string like 'HeroBanner' makes React DOM create an unknown <HeroBanner> element and print the incorrect casing warning, usually followed by the unrecognized tag warning, and your component never runs.
console.log(typeof block.type, block.type)Fix
Keep an object that maps every name your data may contain to the imported component, look the name up, and render a fallback for names you do not know.
import { HeroBanner } from './HeroBanner';
import { Gallery } from './Gallery';
const BLOCKS = { HeroBanner, Gallery };
function Block({ block }) {
const Component = BLOCKS[block.type];
if (!Component) return null; // a type the CMS sent that the app does not know
return <Component {...block.props} />;
}Verify
typeof Component now logs function, and the block renders its real content.
console.log(typeof BLOCKS[block.type]) // functionConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Name every variable that holds a component in PascalCase, including the results of lookups and ternaries.
- Check the type names coming from a CMS or API against the keys of the lookup object, and log the unknown ones.
- Keep the lookup object next to the components it lists, so a new block type is registered in the same change.
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 on the same stack: TaxiDex, QistLock, Taskvare.