In React, capitalizing component names is necessary because it helps distinguish between custom components and HTML elements.
When JSX is compiled, React uses the capitalization of the tag name to determine whether it is a custom component or a built-in HTML element.
Lowercase tag names (e.g., <div>, <span>) are treated as HTML elements.
Capitalized tag names (e.g., <MyComponent>) are treated as custom components.
If you write <myComponent /> (lowercase), React will look for an HTML element called <mycomponent>, which doesn't exist, and throw an error.
HTML elements are case-insensitive and always written in lowercase (e.g., <div>, <p>, <span>).
By capitalizing custom component names, you avoid naming conflicts with existing HTML elements.
<Button> is clearly a custom component.
<button> is an HTML button element.
React relies on tools like Babel to transform JSX into JavaScript. Babel uses the capitalization of component names to determine how to process them.
If you don't capitalize your component names, Babel might misinterpret them as HTML elements, leading to errors or unexpected behavior.
How would you name a new functional component you are adding to a project, and what would happen if you used a lowercase first letter?
If you see a JSX tag that starts with a lowercase letter, how does React interpret it?
What error or unexpected output might you get if you try to render a component defined with a lowercase name?
You added a component called 'profile' and it renders as an HTML element instead of your component. Walk me through how you'd debug and fix it.
A teammate renamed a component to start with a lowercase letter and the UI broke. Explain why and how you'd resolve the issue, considering any lint rules.
When integrating a third‑party library that exports components with lowercase names, what strategies could you use to avoid naming conflicts?
Your team is refactoring a large codebase to enforce PascalCase component names. What tooling, lint rules, and migration steps would you put in place to ensure consistency without breaking builds?
Discuss any performance or bundle implications, if any, of using lowercase versus uppercase component names in a massive React application.
How would you design a code‑review checklist to catch component‑naming violations across multiple teams?
Imagine your organization is moving from a mixed naming convention to a strict uppercase component policy across dozens of micro‑frontends. How would you plan the migration, handle legacy components, and ensure backward compatibility?
What governance model would you propose to enforce naming conventions at scale, and how would you measure its impact on developer productivity and bug rates?
If a legacy component library uses lowercase names and you need to integrate it into a new codebase that enforces uppercase, what architectural approaches could you take to bridge the gap without extensive rewrites?