by madeofpalk · 9y ago · 0 comments
Regardless, I'm not a huge fan of these CSS-in-JS techniques anyway (although I don't mind Styled Components if I have to use it). CSS Modules, to me, is a far better approach and it sits there in the middleground between 'Pure CSS' and 'CSS-in-JS'
> OOCSS, SMACSS, BEM, ITCSS, and ECSS.
The beauty of CSS Modules is that it basically merges _naming conventions_ like BEM into CSS 'master'. You don't need a convention because the language just sorts it out for you.
Imagine arguing against variable scope in any other language with just saying "hey, just manually namespace your variables!"
Here is a talk he did on his reasoning - https://www.youtube.com/watch?v=MT4D_DioYC8
IMO - Use the tools/tech that make you happy.
The problem is where that ideal meets reality. Few developers bother learning CSS in depth to avoid spaghetti and poor practices, so whether we like it or not - that is a fact and a reality we have to deal with.
That's solved by tooling and/or better languages and better abstractions - which is what css-in-js is aiming to do. Coding standards like naming conventions aren't enforceable enough to scale in real life :(.