---
title: "Discussion on \"Why do we keep talking about CSS-in-JS?\" | Hashnode"
description: "Discussion on \"Why do we keep talking about CSS-in-JS?\". Remember the first time you wrote some html/css? It was amazing, right?\n<div style=\"color: blue\">Hello world</div>\n\nSo simple, so pure.\nThen, of course, the senior developer™ told you not to write your css like this and put it a separate file.\n<div c..."
url: "https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/5cd106214aa8c0e857d29813"
---

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

Discussion

# [Why do we keep talking about CSS-in-JS?](https://siddharthkp.hashnode.dev/why-do-we-keep-talking-about-css-in-js?utm_source=hashnode&utm_medium=feed)

Remember the first time you wrote some html/css? It was amazing, right? <div style="color: blue">Hello world</div> So simple, so pure. Then, of course, the senior developer™ told you not to write your css like this and put it a separate file. <div c...

May 7, 2019 · siddharthkp.hashnode.dev  
Read the article

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

## Written by

[Sid](https://hashnode.com/@siddharthkp)

@siddharthkp · Amsterdam, Netherlands

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

ui at @codesandbox + building @ReactUI 🎨 design systems developer, wannabe designer

## Responses 1

Markdown supported · ⌘↵ to post

[Marco Alka](https://hashnode.com/@maruru)

[May 7, 2019](https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/5cd106214aa8c0e857d29813/comment/5cd14f72900d92786fd1cda1)

Thank you for your write-up. Just some questions:

-   Why the hate against a little verbose namespace? It helps understand the context of the rule. Do you have any killer-argument or is it your opinion?
-   How do you make sure you separate your concerns, which is the fundamental basic of decoupling and modularization, which is essential for a bit bigger code bases
-   How do you make your styles re-usable, especially in the case of jsxstyle?
-   How do you guarantee a consistent styling without manual intervention?
-   For what kind of project do you recommend which CSS-in-JS style?
-   What is CSS-in-JS's advantage over the following examples:

```
function LoginForm() {
  return (
    <form class="login">
      <button type="submit">Submit</button>
    </form>
  );
}
```

```
.login button[type="submit"] {
  background: blue;
}
```

---

```
function myButtonBar() {
  return (
    <div class="button-bar">
      <button type="button">Primary Action</button>
      <button type="button">Secondary Action</button>
      <button type="button">Tertiary Action</button>
    </div>
  );
}
```

```
.button-bar {
  button:first-child {
    background: blue;
  }

  button:nth-child(2) {
    background: white;
  }

  button:nth-child(3) {
    background: white;
    border: none;
  }
}
```

[Matthew Ferrin](https://hashnode.com/@mattferrin)

[May 14, 2019](https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/5cd106214aa8c0e857d29813/comment/5cd14f72900d92786fd1cda1#reply-5cdad62a6099b1f4731bac12)

I find myself still doing simple inline styles in React often. I think I take a performance hit, but while I'm opinionated on practically everything else, I haven't been able to form strong opinions on this topic. Inline seems more readable for simple things that aren't handled by a Material Design library or equivalent alternative.

[Marco Alka](https://hashnode.com/@maruru)

[May 14, 2019](https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/5cd106214aa8c0e857d29813/comment/5cd14f72900d92786fd1cda1#reply-5cdadbf7a702ee5a02e84903)

[Matthew Ferrin](https://hashnode.com/@mattferrin) While I certainly still have my opinion about CSS-in-JS, I really recommend not doing inline-styles. There is a reason why they were banned from the HTML5 spec entirely.

Also, there is Vanilla CSS, which means you do your styling without any library or framework at all. Whenever you need to do simple things, don't use a library and try to workaround it when it doesn't fit 😉

[Matthew Ferrin](https://hashnode.com/@mattferrin)

[May 14, 2019](https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/5cd106214aa8c0e857d29813/comment/5cd14f72900d92786fd1cda1#reply-5cdae3860f1a373e76a73e23)

[Marco Alka](https://hashnode.com/posts/why-do-we-keep-talking-about-css-in-js/@maruru), Google search provides no evidence inline styles were removed from spec. I see no reason to do further digging on that vein.
