File Naming: PascalCase vs kebab-case
What you'll learn: You'll understand the two most common ways to name component files in React and why picking one matters more than which one you choose.
The Two Schools of Thought
When you create a component file, you'll typically see two naming patterns in the wild:
PascalCase: MyComponent.jsx, UserProfile.jsx, NavigationBar.jsx
- Matches the component name exactly
- Common in frameworks like Next.js and Create React App templates
kebab-case: my-component.jsx, user-profile.jsx, navigation-bar.jsx
- Uses lowercase letters with hyphens
- Common in enterprise codebases and some style guides
Why Both Exist
PascalCase fans argue it creates perfect alignment: the component UserProfile lives in UserProfile.jsx. You see the filename and immediately know the component name.
kebab-case supporters point out that URLs, CSS classes, and Unix systems traditionally use lowercase-with-hyphens. It keeps everything uniform across the web stack.
What Actually Matters
Here's the truth: consistency matters infinitely more than the choice itself. A codebase mixing UserProfile.jsx and shopping-cart.jsx creates friction. You waste mental energy remembering which pattern each file uses.
Pick one convention for your project and stick with it everywhere. Most teams document this choice in a style guide or enforce it with linting tools.
Think of it like driving on the left vs right side of the road—neither is inherently better, but switching mid-journey causes crashes.
Key Takeaway: Choose PascalCase or kebab-case for your component files, but enforce it consistently across your entire codebase—the uniformity matters far more than which convention you pick.