This article does make the fact that you don't need to use either of the techniques for good code. We have been writing CSS-in-JS for some time now and I have seen poorly written code, so I have to agree doing the right thing is a bit outdated.
But the real reason I have kept writing CSS-in-JS is because I get to keep the styles in the same file as my components. Styles are an integral part of these components and the fact that I can just see the styles that decorate my elements right then and there. Doesn't this put you at disadvantage because you are not seeing the styles adorned by the parent components? Yes, this is true, but that's also the point of creating reusable components.
Can we do this without using CSS-in-JS today? Yes, it called tailwind CSS. But they are not comparable techniques to start with.
Yeah, it's better not to talk about Tailwind, and any other atomic CSS, as long as they are making CSS-in-JS, as well as CSS-in-CSS somehow not important. It's all CSS-in-HTML, I mean your markup.
Anyway - many CSS-in-JS users have styled next to "real" components, as well as many have them separated. Nowadays in almost any editor you might separate your view vertically or horizontally and have styles defined in .csseven closer. So this moment is nothing more than a personal preference and thus don't count.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This article does make the fact that you don't need to use either of the techniques for good code. We have been writing CSS-in-JS for some time now and I have seen poorly written code, so I have to agree doing the right thing is a bit outdated.
But the real reason I have kept writing CSS-in-JS is because I get to keep the styles in the same file as my components. Styles are an integral part of these components and the fact that I can just see the styles that decorate my elements right then and there. Doesn't this put you at disadvantage because you are not seeing the styles adorned by the parent components? Yes, this is true, but that's also the point of creating reusable components.
Can we do this without using CSS-in-JS today? Yes, it called tailwind CSS. But they are not comparable techniques to start with.
Yeah, it's better not to talk about Tailwind, and any other atomic CSS, as long as they are making CSS-in-JS, as well as CSS-in-CSS somehow not important. It's all CSS-in-HTML, I mean your markup.
Anyway - many CSS-in-JS users have
styled
next to "real" components, as well as many have them separated. Nowadays in almost any editor you might separate your view vertically or horizontally and have styles defined in.css
even closer. So this moment is nothing more than a personal preference and thus don't count.