All articlesSoftware Design

How To Craft Flexible UIs In React by Using Generic And Domain Components? πŸ’ͺ

That's part of my book "The Conscious React" πŸ“š

Petar IvanovPetar Ivanov
β€’β€’2 min read
On this page

I’ve worked on various React projects and codebases in the last couple of years.

From small e-commerce clients to big enterprise clients.

I’ve seen how different codebases become tangled, hard to maintain, and develop.

Or how business requirements change and you must refactor most of the app.

In one of these projects, my team and I decided to take a more strategic approach: split components into Generic and Domain categories.

This helped us create more modular, reusable code while addressing the new business needs and requirements.


What Are Generic Components?

Generic components handle common tasks not tied to specific business or domain requirements.

These components provide a solid foundation and can be reused across all pages, no matter the context.

For example: buttons, text inputs, forms, modals, cards, etc.


What Are Domain Components?

Domain components are built on top of these Generic components.

They address the unique needs of your product and business context.

For example, a <BackButton /> might build on Generic <Button /> to handle navigation in a product-specific way.


Why Splitting Components Into Generic And Domain?

  1. Reusability: Generic components are easy to reuse in new features or across different projects.
  2. Maintainability: When business requirements change, you only update the Domain components while the Generic ones stay the same.
  3. Consistency: By having a set of standard building blocks, you product and business look and feel stays consistent.
  4. Scalability: Over time, you can evolve the set of Generic components into a separate UI component library.

πŸ“‹ Recap

  • Prefer creating many reusable Generic components that can be further extended and composed into more specific Domain components.
  • Splitting components into Generic and Domain categories helps your codebase to be more reusable, maintainable, consistent, and ready to scale.

Related articles

Whenever you’re ready, here’s how I can help you:

  1. 1.

    The Conscious React: React architecture, design & clean code β€” 100+ production tips across 6 chapters, updated for React 19, plus 4 companion repos you can clone and run.

  2. 2.

    The Conscious Node: Node.js architecture, design & clean code β€” 157 production tips across 10 chapters, from module boundaries to the transactional outbox and zero-downtime deploys.

  3. 3.

    The JavaScript Architect Bundle: Both books + all React companion repos + CLAUDE.md rulesets + both playbooks. The complete path from developer to architect.

  4. 4.

    Free Resources: Architecture playbooks, cheat-sheets, and the JavaScript Architect Roadmap β€” practical guides for leveling up to senior.

The T-Shaped Dev

Join 30K+ engineers leveling up to architect

One practical tip on JavaScript, React, Node.js, and software architecture every week. No spam, unsubscribe anytime.

Petar Ivanov

Written by

Petar Ivanov

Software engineer, author, and speaker. I help JavaScript developers grow from Mid β†’ Senior β†’ Architect β€” production-grade React, Node.js, and AI systems.