Name components by what they are, not by where they live. UserProfile is clear; CardRight is not. Good names make a codebase readable and help you find components quickly.
How to Create Your First React Components From Scratch
How should I name React components?
The answer
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.
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.
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.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.