| A 4 year experienced react dev here. I have had decent time working with different styling I'll try to answer few common things for everyone's context Why even use CSS in JS? - SPA bundling usually loads all CSS at once and all styles collide. You need to be super good at naming stuff/or load CSS based on module. So your CSS will be conflicting, so scoping is helpful here. - Not having to jump from your component file to CSS file. Save some context switching or few strokes. - Dynamic control over style. Basically your stylesheet is JS function returning style. You can do anything here. See this https://github.com/styled-components/styled-components/issue... - Support for JS reference in color, font sizes, etc with editor support. It'll lead to more consistent design system. - More cleaner API when using media queries, pseudo states. eg-https://emotion.sh/docs/media-queries Another alternative is Emotion, also I find it to be much more cleaner in code perspective. (Good performant library in terms of layout and painting). Why is export option not available for most CSS in JS (some suggested this as solution)? Read this https://github.com/emotion-js/emotion/blob/bcf40cf2c20153481... Is it worth it? - Depends a lot on context and your perfonal objective. Generally I personally feel it's worth it as it's good tooling. - CSS in JS is lot better than what it used to be. Styled component had good perf bump in last few years. |