Hacker News new | past | comments | ask | show | jobs | submit login
Let me try to explain CSS in JavaScript to you (giuseppegurgone.com)
6 points by tomduncalf on Dec 10, 2018 | hide | past | favorite | 1 comment



Personally, as a developer who’s main strength is JS but who is okay at CSS (but doesn’t love it!), I can’t imagine working without CSS-in-JS these days. The main selling points for me are keeping styles local to a component (I was using BEM before using CSS-in-JS so this was an easy sell to me - the reality of the cascading part of CSS is it is hard to manage on a team or if you aren’t a CSS expert, so in some ways I see this as damage limitation by introducing boundaries, and making things easier to reason about) and the ability to use JavaScript rather than a bespoke template language to express logic in CSS.

I’m currently using the Styled Components pattern (with emotion and React) and I quite like it... feels quite elegant in practice and makes the code nice and maintainable. Interested to get others opinions anyway!




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: