4 ms·
Thanks for the explanation. Yes that’s correct, it’s the same concept as css modules but with scss instead of css. I have to say though that this doesn’t seem
by jf- 8y ago
Thanks for the explanation. Yes that’s correct, it’s the same concept as css modules but with scss instead of css.
I have to say though that this doesn’t seem like much of an advantage - it boils down to not having to create class names and use className={...}. The other possible advantage is not having any .css/.scss files, which to me is actually a disadvantage- I quite like the separation of concerns concept, having html and js mixed together in jsx already irks me, adding styles as well is just too much!
Also, with css in js I believe that pseudo elements and animations are an issue, whereas there is no problem with these with scss modules. They both seem like valid options, but for me modules wins it.
- exogen 8y ago> Also, with css in js I believe that pseudo elements and animations are an issue Here you might be remembering a particular, older technique known as "inline styles." This is probably the oldest CSS-in-JS technique, and has greatly fallen out of favor. Modern CSS-in-JS doesn't use that method anymore, and can do everything that normal CSS can do (in part because it really is just generating real CSS). So pseudo elements, media queries, animations etc. are no problem. :)