r/programming • • Feb 18 '19

Why I Write CSS in JavaScript

https://mxstbr.com/thoughts/css-in-js/
0 Upvotes

10 comments sorted by

View all comments

3

u/cbrantley Feb 18 '19

We just had a recent dust up about this at my company. There was a solid styled-components camp and a solid traditional style sheet camp.

After listening to all the arguments we determined there is room for both. When a component requires specific styling to work properly (modals, for example) we put the styles in the component itself.

For general styling and theming we use a more traditional setup with SASS.

This gives us a nice separation of concerns between “functional” and “presentational” styling. And it means our designers can change the look and feel without breaking components and our engineers can update components without needing to dig through the SASS.

4

u/kshep92 Feb 18 '19

When a component requires specific styling to work properly (modals, for example) we put the styles in the component itself

Isn't this what Custom Elements/Web Components was supposed to do, albeit in more standards-based way?