DEV Community

Discussion on: Classical CSS vs CSS in JavaScript

Collapse
 
richardeschloss profile image
Richard Schloss • Edited

I don't think classical CSS gets enough credit. It's very powerful. Even as a very basic example, I think it's very cool that even to get a simple hover effect, it's as simple as appending ":hover" to the class rule. Anyone can probably look at that css rule and understand what it does, or at least understand it quicker than css-in-js code. Personal feeling is that's easier than writing the mouseover javascript event to add the style. I think if more people stayed up to date with MDN and CSS-tricks, they'd give classical (well, I call it advanced) css. I call it advanced because the native css is constantly improving and catching up to what some of the pre-compilers can do.

I think if there are certain css properties that need to be controlled based on application data, then css-in-js makes sense, but only for those cases. I'm sure my comment will get mixed reviews, but I'm just speaking from experience.