Facebook Pixel

Why must React component names start with a capital letter?

Because React uses capitalization to distinguish custom components from built-in HTML tags. A lowercase name is treated as a DOM tag like div, while a capitalized name is treated as a component.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in How to Create Your First React Components From Scratch

Write a JavaScript function whose name starts with a capital letter, and have it return JSX. You can then use that function name as a custom tag inside other components.

Props let you pass data into a component so it can render differently based on that data. A greeting component that takes a name prop can greet anyone, instead of being hardcoded to one name.

Not directly. A component must return a single root. To return siblings without an extra wrapper element, use a React fragment, written as empty angle brackets.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.