Course contentsShow
← React
Lesson 198 of 2,3966. Component BasicsFree lesson

PascalCase for Component Names

Why React components must start with a capital letter and follow PascalCase naming convention.

What You'll Learn

You'll learn the exact naming convention React components must follow and why breaking this rule causes your components to fail.

The PascalCase Rule

React has a strict requirement: every component name must start with a capital letter and follow PascalCase (also called UpperCamelCase). This means UserProfile, NavBar, Button — never userProfile, navbar, or button.

Why This Rule Exists

React uses the capital letter to distinguish between HTML elements and custom components:

// Lowercase = HTML element (built-in)
<div>Hello</div>
<button>Click me</button>

// PascalCase = Your component
<UserProfile />
<Button />

If you write <button />, React renders a native HTML button. If you write <Button />, React looks for your custom Button component.

What Happens When You Break This Rule

// WRONG - lowercase component name
function userCard() {
  return <div>User Info</div>;
}

// React treats this as an HTML tag, not your component
<userCard />  // Renders nothing or throws an error
// CORRECT - PascalCase
function UserCard() {
  return <div>User Info</div>;
}

<UserCard />  // Works perfectly

The Analogy

Think of it like proper nouns in English. HTML tags are common nouns (lowercase): "the button," "the div." Your components are proper nouns (capitalized): "Button," "UserCard" — they're specific, named things you created.

Key Takeaway

React components MUST use PascalCase (start with a capital letter) so React can distinguish them from built-in HTML elements. Lowercase names are treated as HTML tags and won't invoke your component function.