iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😵

Why I stopped using Atomic Design in React

に公開
2022/10/14

Update

I have accumulated more insights, so I wrote a new article regarding directory structures.
https://zenn.dev/dove/articles/039e5bfaf8070f


A long time ago, I stopped organizing component directories based on Atomic Design.

The current directory structure (based on create-react-app) is as follows:

  • src
    • assets
    • components
      • designSystems
      • recipes
        • directory per page
    • helpers
    • store
    • pages
    • App.tsx
    • index.tsx
    • routes.tsx
    • ...omitted

Why I stopped using Atomic Design:

  • When creating a component, thinking about whether it is an "atom" or an "organism" is a hassle. With hooks making it easy to fetch APIs, I decide whether to call an API in a component through trial and error, but Atomic Design forces you to decide from the start. Consequently, I started putting all components into "organisms" for the time being.
  • When using UI libraries, there are surprisingly few "atoms."
  • Components often change their structure during the refactoring process—shifting between atoms and molecules—so moving them becomes a chore.
  • Arguments over whether something is an "atom" or not are exhausting.

In the end, I decided to create directories on a per-page basis and call components from page components via those directories (recipes). Common components still exist, so I put them in a directory called designSystems. There is no need to distinguish whether these are atoms or molecules. The names ended up this way through trial and error, though the philosophy differs from this article: https://bradfrost.com/blog/post/design-system-components-recipes-and-snowflakes/

Creating components on a per-page basis is much easier because you can just build them under that directory without overthinking.

It is difficult to create components with commonality in mind from the start, and there is a chance they might not even be reused. If there are similar components, I temporarily resort to copy-paste programming and then unify them through refactoring later.
Atomic Design felt too much like a finished product from the beginning, which was exhausting.

Discussion