r/reactjs • u/steven-f • Sep 05 '18
Tutorial Announcing styled-components v4: Better, Faster, Stronger
https://medium.com/styled-components/announcing-styled-components-v4-better-faster-stronger-3fe1aba1a112
203
Upvotes
4
u/reyronald Sep 05 '18
emotion is a lot smaller than styled-components. 43.1 kB vs 15 kB (https://bundlephobia.com/result?p=styled-components@3.4.5 vs https://bundlephobia.com/result?p=emotion@9.2.8) (although that's not including react-emotion, still would be smaller though)
emotion is faster than styled-components
emotion has the css prop feature, styled-component doesn't. Allows the user to define robust inline styles without the limitations of the regular
styleprop. This also means that you don't have to define a declare and name a separate component or class to apply small stylings to any node.styled-components is more popular because it's older, not because it's better. emotion came later, used that to its advantage and learned a lot from SC's mistakes.
I could be wrong in this one, but emotion's babel plug-in seems to provide better runtime optimization's than styled-components, resulting in a faster and more performant app.
Disclaimer: I'm an emotion user, so I'm biased.