Organizing component architecture and structure in React
As React applications grow, keeping your component architecture clear and maintainable is essential. A well-structured codebase makes collaboration easier, reduces duplication, and improves developer experience β especially in teams or when building scalable design systems.
This post shares how I organize components and visual structure in React, based on current best practices, including recent patterns influenced by modern frameworks like Next.js, React Server Components (RSC), and design systems.
π‘ Group by feature or domain
Rather than splitting everything into global folders like components/
, hooks/
, or utils/
, I prefer grouping by feature or domain. This approach scales well and mirrors how users experience the app.
src/
βββ dashboard/
β βββ components/
β βββ hooks/
β βββ index.js
β βββ DashboardPage.jsx
βββ settings/
β βββ ...
βββ shared/
β βββ components/
β βββ utils/
β βββ theme/
π¦ Presentational vs container components
Although hooks have blurred the line between UI and logic, separating presentational components (focused on visuals) from containers (focused on logic/state) is still helpful β especially for reusability and testing.
/components/
βββ Button/
β βββ Button.jsx
β βββ Button.test.js
β βββ button.module.css
β βββ index.js # for clean imports
βββ UserProfile/
βββ UserProfile.jsx # Presentational
βββ useUserProfile.js # Data logic
βββ index.js
This setup supports co-location of styles, tests, and logic within the componentβs folder.
π¨ Visual hierarchy and design consistency
Organize UI layers from the page level down to atoms:
Pages β Layouts β Sections β Components β Elements
Best practices:
- Use design tokens for consistent spacing, color, and typography.
- Build from a shared theme system (especially if using styled-components, Tailwind, or CSS Modules).
- Avoid deeply nested components when a flat composition will do.
- Define component boundaries based on reusability and context, not visuals alone.
βοΈ Modern Patterns in 2025
As of 2025, these trends continue to shape how teams structure React projects:
- React Server Components (RSC) via Next.js App Router encourages clear separation between server and client logic β keep non-interactive UI server-rendered when possible.
- Co-location of everything (styles, logic, stories, tests) is the norm.
- Feature-first or route-first structures scale better than global folders.
- Atomic Design principles are still useful for thinking in reusable parts, though not always implemented rigidly.