Live data from Hacker News

Maintainability Through Colocation

kentcdodds.com

1–4 of 4 posts

Re: Maintainability Through Colocation

#2
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.