On this note, I’m excited to talk about how we do styling at FB in the future! Maybe a small conference talk would be appropriate.
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I definitely agree with this sentiment. I'm curious what you mean by dynamic values. How would dynamic values be prevented in JS?
-
You can restrict them at lint or compile-time. eg. you disallow {color: generateColor()} You can also support a bunch of other stuff if the values are all used locally, for example: const baseRadius = 2; {borderRadius: baseRadius * 2}
- 4 more replies
New conversation -
-
-
Can you elaborate even further on the dynamic values you would ban? Would you ban CSS variables & emerging CSS color functions involving shade & etc?
-
I would ban deriving style values from dynamic JS values.https://twitter.com/sebmck/status/1027294724435075072 …
End of conversation
New conversation -
-
-
If your motivation for using css in js is to remove the cascade, why not just write stricter css?
-
When you write CSS you still need to deal with specificity issues. I don't want to worry about correctly namespacing all of my styles. Colocation of styles with your component code is generally good. Changes are isolated to one place, dead code is removed easily.
- 1 more reply
New conversation -
-
-
There develops this unfortunate divide between the way styles would make sense and “performance styles”. Especially if your doing single immutable atom, it sucks to for example enforce a state for hover styles vs. using :hover.
-
Hover shouldn’t be considered a local state conceptually. It’s a global state. It can be modeled as such. However when I tried to optimize it, it started looking very similar to local memoization.
- 9 more replies
New conversation -
-
-
Cascadeless Sebastian Sheets in JS?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 