> But why is it wrong to use the style attribute? What makes using tailwind to do the same thing "not wrong"?
The time people were taught it was wrong is thr time when all your elements were rendered on the server and the style was duplicated for every component it applied to.
Client rendered JS only sends it over the wire once and then duplicates it on the client.
Tailwind only allows a few options, so it’s less likely you have slightly different styles everywhere.
I think the awful syntax you talk about is really nice, since it covers 99% of everything I ever need to do with it. The cascading part of CSS is really cool, but 99% of the time it’s confusing when I don’t need it.
Tailwind I use for hobby projects but we’re still sticking with style={{…}} at Notion. Since the app launched there’s been many generations of CSS-for-React (Airbnb Aphrodite era, styled-components/Emotion era, styled-jsx/linaria era, CSS modules era, Tailwind era) come up, get hype, and then thrown in the trash heap. Probably the best move for us would be an optimizing compiler for style={{…}} or our useStyles hook.
The time people were taught it was wrong is thr time when all your elements were rendered on the server and the style was duplicated for every component it applied to.
Client rendered JS only sends it over the wire once and then duplicates it on the client.
Tailwind only allows a few options, so it’s less likely you have slightly different styles everywhere.
I think the awful syntax you talk about is really nice, since it covers 99% of everything I ever need to do with it. The cascading part of CSS is really cool, but 99% of the time it’s confusing when I don’t need it.