DEV Community

Discussion on: ReactJS: Component everything or not?

Collapse
 
helderberto profile image
Helder Burato Berto • Edited

I always try to solve the problem first and after that, I start to break in smaller components.

I tend to follow the principle of Atomic Design to organize my application.

I keep in mind the following directory organization:

- src/components
      - atoms
      - molecules
      - organisms
      - templates

Atoms

The smaller components commonly are the basis to start more complex ones.

Molecules

Normally here the components have a union of atoms, start to be useful, and be more visible.

Organisms

It's a combination of atoms and molecules forming bigger sections in the application.

Templates

This part consists of a group of organisms forming a page, but personally I don't use in every project I made.

Collapse
 
stereoplegic profile image
Mike Bybee

This is a good way to think even if you're not following this sort of structure. Just because you're not using e.g. a button for multiple purposes right now, that doesn't mean you won't as the project comes closer to fruition.