6 ms·
Yeah, I was mostly going after a direct comparison with styled-components. I used to be quite happy with css-in-js because of its simplicity but found that it
by davnicwil 9y ago
Yeah, I was mostly going after a direct comparison with styled-components.
I used to be quite happy with css-in-js because of its simplicity but found that it doesn't scale very well to large & complex apps.
About a year ago I was introduced to styled-components by a colleague and though initially sceptical (it took me a little while to grok its patterns) I've found it really nice, it solved basically all of the issues I found with scaling styles inside a React app, and I haven't looked back. The only concern I have with it is its not insignificant contribution to bundle size, but that's literally the only thing that would dissuade me from using it on any new project by default.
Since it obviously fits so well with the 'React way', and allows you to colocate styles within components with full access to the power of JS for building complex styles dynamically, I just wonder why you'd go for Sass, which is a great but much more general purpose tool, when it exists?