3 ms·
What's the advantage of css in js as opposed to just plain css?
by hiyer 3y ago
What's the advantage of css in js as opposed to just plain css?
- nprateem 3y agoStyling based on js, eg striking through if an item becomes deleted, etc
- tlrobinson 3y ago- Styles colocated with markup/logic (I consider this an advantage with a component library like React, others may not) - 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
- naman34 3y agoWe're solving the performance pitfall of CSS-in-JS libraries by making a compiler instead. In the vast majority of cases, there should be zero runtime cost to using StyleX.
- zip1234 3y agoRefactoring and knowing where styles are used. In css sometimes the btn class does something and sometimes not. With stylex it is explicit.
- BigJono 3y agoAbsolutely fuck all.