News for hackers. Stuff that matters.
Re:CSS-In-JS and Static Rendering by forsythe on Sunday February 03, 2019 @06:59AM (#19069139)
Personally, I don't mind the concept. I can write CSS on a microwave if I have to. But CSS is supposed to be simple, not to be mixed with JS.

There are good designers out there who know HTML and CSS but not JS. This will lead to a problem for those people.

Let's be honest, you cannot just jump into a React component and edit CSS if your knowledge of JS is slim to none.

Re:CSS-In-JS and Static Rendering by andrewingram on Sunday February 03, 2019 @11:00AM (#19070285)
There are good designers out there who don't know HTML, CSS or JS. There are also good designers out there who know all three.

CSS-in-JS (or if not, BEM at the least) is a closer fit to the mental model of styling things in design software like Sketch and Figma. So having to use CSS in full utilising-the-cascade-and-complex-selectors mode could reasonably be seen as a bigger barrier to entry than just using something like Styled Components or Emotion. I've come across plenty of designers comfortable with CSS who felt more at home using Styled Components.

I'm not arguing that there won't be some people for whom CSS-in-JS creates barriers, but there will also be others for whom it knocks them down.

Re:CSS-In-JS and Static Rendering by ggurgone on Sunday February 03, 2019 @09:28AM (#19069697)
simple != reliable

What is so hard about writing CSS in JS?

Re:CSS-In-JS and Static Rendering by yowlingcat on Sunday February 03, 2019 @10:31AM (#19070076)
Scoping. The way you style a large, complex application is going to be very different using CSS-In-JS vs pure CSS.
Re:CSS-In-JS and Static Rendering by nullandvoid on Sunday February 03, 2019 @11:59AM (#19070669)
I think you're missing the point you can do both? If you want to load a global stylesheet for common theming and then provide component level CSS in JS then that's absolutely fine and even suggested. Having dealt with many styling solutions in my time I find using styled components with the style mentioned is one of the greatest developer experiences I've had in many years. Being able to interpolate your react state within your css is just great and opens up the doors to massively simplify dynamic layouts which the state of which are much better represented in JS
Re:CSS-In-JS and Static Rendering by Chyzwar on Sunday February 03, 2019 @10:44AM (#19070165)
Yes, it is going to be safer and much simpler.
Re:CSS-In-JS and Static Rendering by JustSomeNobody on Sunday February 03, 2019 @01:43PM (#19071341)
I don’t understand, simple things do tend to be reliable.