|
|
|
|
|
by kowdermeister
3484 days ago
|
|
It makes no sense for 99.9% of the apps out there. If you are running at Facebook or Google level, maaaybe. This whole madness started with a FB dev presentation about running CSS "at scale". Then folks started to copy each other and this is what we have now. Just look at https://github.com/rtsao/styletron there's a whole "how to use it" page, but zero info WHY to use it. Not even a section about valid use cases. IMHO SASS covers almost all cases of CSS "at scale". > It seems like mixing the actual styles in with the JS violates separation of concerns and clutters up the actual logic. It does not just seem like it... it does violate it for no good reason. |
|
The implementation of a UI widget is ultimately a combination of CSS, HTML, and JS which are coupled to some degree, so by colocating them together, the component is easier to manage. But to do this effectively, you need some way to get around the global nature of CSS. CSS modules and CSS-in-JS are means of achieving this.
A good blog post about this topic is: https://medium.com/seek-developers/the-end-of-global-css-90d...