---
title: "Discussion on \"Is CSS-in-JS actually bad?\" | Hashnode"
description: "Discussion on \"Is CSS-in-JS actually bad?\". Or \"why I made a CSS-in-JS library in 2023\""
url: "https://hashnode.com/posts/is-css-in-js-actually-bad/63cd64fdfb26904311039f0c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Is CSS-in-JS actually bad?](https://blog.mayank.co/is-css-in-js-actually-bad?utm_source=hashnode&utm_medium=feed)

Or "why I made a CSS-in-JS library in 2023"

Jan 22, 2023 · 9 min read · blog.mayank.co  
Updated Feb 8, 2023  
Read the article

-   [#css](https://hashnode.com/tag/css)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Mayank](https://hashnode.com/@mayxnk)

@mayxnk

  
[View profile](https://hashnode.com/@mayxnk)

frontend stuff

## Responses 3

Markdown supported · ⌘↵ to post

[Veit Lehmann](https://hashnode.com/@levito)

[Mar 17, 2023](https://hashnode.com/posts/is-css-in-js-actually-bad/63cd64fdfb26904311039f0c/comment/6414e9ca4f10afbe5c4c2de2)

This looks nice! I was always hesitant about using CSS-in-JS because it adds another abstraction with more or less subtle differences between different implementations, both in DX and in performance impacts.

So far, I'm happy with CSS modules which solve the most important problem of scope in a predictable way.

ecsstatic seems to be the CSS-in-JS solution that's pretty much the closest to CSS modules. You could even use it like that when keeping your styles in a separate file.

So the benefits of ecsstatic over CSS modules that I can think of are:

-   ability to keep styles in the component file
-   you can automatically catch unused classes

But I also see drawbacks:

-   advanced CSS selectors may not be possible or at least harder to do
-   jumping back and forth between CSS and JS syntax when styling might not feel right
-   limited IDE/editor support

What do you think? Do you agree? Did I miss anything?

[Gulshan Negi](https://hashnode.com/@gulshan212)

[Jan 27, 2023](https://hashnode.com/posts/is-css-in-js-actually-bad/63cd64fdfb26904311039f0c/comment/63d3d2aae56ca315fdf80275)

HI this is Gulshan Negi Well, One of the main arguments against CSS-in-JS is that it can make code harder to understand because it mixes together two separate concerns: layout and behavior. This can make it harder for developers to reason about the code and make changes to it.

Thanks

[Youssef Hassan](https://hashnode.com/@joehsn)

[Jan 25, 2023](https://hashnode.com/posts/is-css-in-js-actually-bad/63cd64fdfb26904311039f0c/comment/63d196112086bff3543cac93)

Appreciated!
