StyleX – Meta's styling library
31–40 of 86 posts
Re: StyleX – Meta's styling library
#32Re: StyleX – Meta's styling library
#33What's the advantage of css in js as opposed to just plain css?
Re: StyleX – Meta's styling library
#34Earlier quoted context omitted.
0 runtime is the argument over emotion (and therefore MUI right now)
thanks for pointing this out. I hope they extend their `thinking in stylex` page with this info.
https://stylexjs.com/docs/learn/thinking-in-stylex/
> There is no runtime overhead here
Specifically
> No runtime style injection.
There's still a runtime though
> Optimized runtime for merging class names.
Re: StyleX – Meta's styling library
#35What's the advantage of css in js as opposed to just plain css?
- No global styles stomping on each other, styles scoped to a single module unless explicitly exported/imported
- Type safety, if using TypeScript
The main downside is often performance, though
Re: StyleX – Meta's styling library
#36What's the advantage of css in js as opposed to just plain css?
Re: StyleX – Meta's styling library
#37I hate having to give everything a name like people do in react native stylesheets. Give me an inline performant style prop any day
You already have to name your CSS classes, and atomic CSS libraries are chock full of names you must learn . What do you mean "inline style prop," writing CSS in the HTML style attribute? That's a nightmare to manage across large apps, not composable or reusable, and this library compiles to performant styling (according to the authors/examples).
In addition, with robust IDE support, you can type the css attribute and get autocomplete suggestions for the relevant utility.
Re: StyleX – Meta's styling library
#38Re: StyleX – Meta's styling library
#39Just at a cursory glance, this looks pretty verbose and clunky. Existing React ecosystem styling solutions are many, so it’s not immediately evident to me when you would accept the trade offs introduced by this tool over any existing ones that seem much nicer to not only integrate, but also have to work with day to day.
it was exciting at launch, but took forever to ship, and now Tailwind has run away with that problem.