re: How I structure a React project VIEW POST

FULL DISCUSSION
 

I hate this approach. Oh, how I hate this approach.

Let's say - you need a Button.

  • While you are developing it - it could be clear for you what it is. Probably it is an Atom.
  • But then you are refactor it, extracting some pieces, and BAM! it shall be a Molecule.
  • Then you will add some state to it, to track visual state in a fancy way and BAM! it shall be an organism.
  • Then you reactor it to keep all the "state" in a CSS - you can do it for a button.
  • And what then? Shall it be atom again? It quaks like an Atom, it's walks like an Atom - IT'S AN ATOM!

Even worse scenario - you have keep this component discoverable. You have to know there to look for it.

Separation shall not be done by how something is made - it's an implementation detail. Separation shall be done by a responsibility you can reason about - screen, page, component, internal component stuff which shall not be ever used outside.

Smart/Dumb component separation is also quite dumb. It's a right separation, but you might have both components if not in one file, then in one directory.

Separation should be made in a way you never would be forced to rename or move your component after refactoring, and it would be always easy to find it. And use. And test.

 

Thank you for this strong opinion :)
It is always good to know what are the drawbacks of a given approach.

This idea is a living process.
Thanks to your feedback, maybe we will optimize it, or discover even something better.

code of conduct - report abuse