
Maintainability Through Colocation - yvonnick
https://kentcdodds.com/blog/colocation
======
ummonk
Very much agree with this, and I tend to make similar decisions, including
strongly preferring CSS in JS frameworks.

The one item I'd caveat though is colocation of state. The author is right
that often it is best to colocate state with the component that needs it. On
the other hand though, often the state cannot be decoupled in this way and you
have interactions between states of different components; in these cases, it
is often better to colocate all the state together in one place. That is the
essence behind e.g. stores like redux in web programming.

------
smadge
Why not colocate your database queries and business logic inside of your
view/template/stylesheet? Just put it all in one file.

~~~
yvonnick
I do it in React using hooks. For example with GraphQL queries.

