2021-01-21
1139
#css-in-js#react
Kasra Khosravi
32347
Jan 21, 2021 â‹… 4 min read

Styled-components vs. Emotion for handling CSS

Kasra Khosravi Founder at FeedbackOnSite.co.

Recent posts:

Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 â‹… 7 min read
Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 â‹… 10 min read
View all posts

4 Replies to "Styled-components vs. Emotion for handling CSS"

  1. Interesting read 🙂

    I did the same comparison a month ago. I built two simple blog applications with a dark theme. One with Emotion and one with Styled Components. I used the object syntax for styling my React components

    Styled components and Emotion looked equal in any way. All I had to do was change the imports.

    Regarding performance and bundle size; there was barely any noticeable difference. The Emotion.js proof of concept was like 2kb smaller.

    Since I was already using Emotion.js for my React projects I chose to stick with it.

  2. Your styled-component examples import from ‘@emotion/styled’ which is misleading, but also highlights the fact that the API for these 2 libraries is nearly identical. It would have been helpful to have a technical breakdown comparing performance, bundle sizes, and limitations of each library.

  3. The styled-components examples have the wrong imports in the code blocks. You should correct these for clarity.

  4. Thanks Kasra for comparing them and thanks Peter for sharing your results too.

    Based on that, I would choose Styled Components because of the community, at least on GitHub, the numbers are double compared to Emotion.

Leave a Reply