jpesewang.work
HomeProjectsBlogContact
Back to Blog
React/Next.js naming conventions for clarity and scalability.
Leif Le
October 21, 2025
5 min read

React/Next.js naming conventions for clarity and scalability.

Naming conventions matter a lot in Next.js and modern frontend projects for clarity and scalability. Here’s a quick breakdown of the best naming conventions used in real-world Next.js + TypeScript projects

🧱 Folder & File Naming Guidelines


1. Folders

βœ… Lowercase-with-dashes (or just lowercase)

➑️ Easy to type, consistent with most open-source repos.

Example:


src/
β”œβ”€ components/
β”œβ”€ hooks/
β”œβ”€ features/
β”œβ”€ lib/
β”œβ”€ utils/
β”œβ”€ app/
└─ styles/


2. React Components

βœ… PascalCase (FileUpload.tsx)

➑️ Matches how React components are named (<FileUpload />).

Examples:


components/
β”œβ”€ ui/
β”‚ β”œβ”€ FileUpload.tsx
β”‚ β”œβ”€ ThemeProvider.tsx
β”‚
β”œβ”€ layout/
β”‚ └─ Header.tsx
β”‚
└─ common/
└─ LocaleSwitcher.tsx


3. Hooks

βœ… camelCase with use prefix

➑️ Matches React’s naming convention for hooks.

Examples:


hooks/
β”œβ”€ useAuth.ts
β”œβ”€ useMobile.ts
β”œβ”€ useToast.ts
└─ useFileUpload.ts


4. Utility Files

βœ… camelCase or kebab-case

➑️ For reusable helpers that aren’t components or hooks.

Examples:


utils/
β”œβ”€ formatDate.ts
β”œβ”€ axiosInstance.ts
└─ fileHelpers.ts


5. Feature-Based Folders (recommended for scaling apps)

As your app grows, use feature-based structure inside src/features/:


features/
β”œβ”€ auth/
β”‚ β”œβ”€ components/
β”‚ β”‚ └─ LoginForm.tsx
β”‚ β”œβ”€ hooks/
β”‚ β”‚ └─ useAuth.ts
β”‚ β”œβ”€ services/
β”‚ β”‚ └─ authApi.ts
β”‚ └─ types.ts
β”‚
└─ dashboard/
β”œβ”€ components/
β”œβ”€ hooks/
└─ pages/


6. Next.js app folder

βœ… Keep route folders lowercase (matches URL path).

βœ… Use PascalCase only for component files inside.

Example:


app/
β”œβ”€ login/
β”‚ β”œβ”€ page.tsx
β”‚ β”œβ”€ layout.tsx
β”‚ └─ components/
β”‚ └─ LoginForm.tsx
└─ dashboard/
β”œβ”€ page.tsx
└─ components/
└─ DashboardHeader.tsx


βœ… Summary


TypeConventionExample

Folder

lowercase / kebab-case

components, use-hooks

Component

PascalCase

FileUpload.tsx

Hook

camelCase (with use)

useAuth.ts

Utility

camelCase / kebab-case

formatDate.ts

Route Folder

lowercase

/auth/login/page.tsx

Related Articles

TypeScript Best Practices for Large Applications

Essential TypeScript patterns and practices that will help you build maintainable applications.

Jan 5, 202410 min read

React Performance Optimization Techniques

Learn advanced techniques to optimize your React applications for better performance.

Dec 28, 202315 min read

Enjoyed this article?

Subscribe to get notified about new articles and updates.