Stylex
stylexjs.com
stylexjs.com
With CSS, you can leverage dev tooling and take advantage of the powerful features that it offers. If you try jamming something like an :is() selector into the arbitrary string of an object key, it becomes an unmanageable mess. I feel like type safety isn't a feature, it's a "fat-finger mistake" deterrent.
I used to be on team CSS-in-JS. These days I prefer to use CSS modules.
That said, I find the tooling for CSS modules tends to be fairly dire - type annotations are poor, jumping between different files is a nuisance, jump-to-definition rarely behaves correctly, etc. It could be a lot better, but it feels like there's no single organisation pushing CSS modules forwards like they have with certain CSS-in-JS frameworks, or with Tailwind.
I used to prefer object notation because of the typing, but I found a VSCode extension that gives you full CSS autocomplete in the template.
I’m interested in how this compares to styled-components but particularly more interesting to me is the comparison with vanilla-extract which is a vastly better alternative to styled-components and does it all at build time instead.
Unfortunately it’s uncommon to see insightful conversations on HN about anything React or web related.
No, Tailwind has no equivalent that I'm aware of (someone correct me if I'm wrong)