Component name not capitalized
Quick summary
You defined a component with a lowercase name — React treats <myComponent> as a DOM element, not a component, and renders nothing.
Why this happens
The component function or class is defined with a lowercase first letter, e.g., function myComponent() instead of MyComponent
The component is imported with a lowercase name and used as <myComponent> in JSX
A variable holding a component is lowercase, and JSX interprets the tag as a native HTML element
Minimal example
function greeting({ name }) {
return <p>Hello, {name}</p>;
}
function App() {
return <greeting name='World' />; // treated as DOM element
}function Greeting({ name }) {
return <p>Hello, {name}</p>;
}
function App() {
return <Greeting name='World' />; // treated as component
}Capitalizing the component name tells React to treat it as a component rather than a DOM element, so it renders correctly.
How to diagnose
Check if the component renders nothing or an unknown HTML element in the DOM inspector
Verify the component function or class name starts with an uppercase letter
Look for React warnings in the console about unknown DOM elements with lowercase component names
How to fix
Rename the component to start with an uppercase letter: MyComponent instead of myComponent
Use PascalCase for all component names in both definition and JSX usage
If using a variable to hold a component, assign it to a capitalized variable before using in JSX
How to prevent
Always name components with PascalCase (uppercase first letter) to distinguish them from HTML elements
Use a linter that enforces PascalCase naming for React components
Related Resources
Related Lessons
- Components
Learn about components.