▲ | lioeters 2 days ago | |||||||
The CSS-in-JS approach has always felt to me like too many steps removed from actual CSS. I tried Styled Components long time ago and didn't like it. I prefer CSS Modules, and Sass still (though trying to move away due to breaking changes in next major version). And use JS to only add/remove classes. Interesting, in their list of long-term CSS-in-JS alternatives, they include Tailwind. I see it as CSS in HTML/JSX class attributes. Then I suppose HTMX is JS in HTML. A new one I hadn't heard of, React Strict DOM. Apparently it's a cross-platform styling library for React Native. https://facebook.github.io/react-strict-dom/ > React Strict DOM lets you create user interfaces that look and feel right on every platform. Web apps are rendered to HTML and rely on static CSS. Native apps look and feel native because the UI is truly native, not a web view. Yeah, for this use case, I can appreciate the value of having styling primitives in JSX. It's not CSS, but a higher abstraction that includes web and platform-native styles. | ||||||||
▲ | madeofpalk 2 days ago | parent | next [-] | |||||||
"[Too many] steps removed from actual CSS" is the whole point. From what I've seen at multiple productive companies is that people just aren't good at writing CSS. People who are really good at it are few and far between, so CSS-in-JS is an attempt to scale out styling across a large team that lacks widespread expertise in it. | ||||||||
| ||||||||
▲ | floydnoel 2 days ago | parent | prev [-] | |||||||
> Tailwind. I see it as CSS in HTML/JSX class attributes. In React, the HTML/JSX is embedded in JS. So I think it could be viewed as both! |