Hacker News new | ask | show | jobs
by zoontek 2306 days ago
This article is wrong about React: it does not generates unreadable CSS class names. CSS in JS libraries do.

By default, using only react + react-dom, you can achieve the exact same output as "handwritten HTML + CSS".

But CSS in JS is not bad either: it generates unique class names by using murmurhash on rules and it makes a lot of sense in a component approach (you can see it like an automatic BEM method).

Even better: The main pain point of this approach (runtime cost) will soon entirely disappear. Linaria already provides a solution, Facebook will soon roll is own (called StyleX for now). It will create a stylesheet file with atomic CSS rules (one rule per class) and replace the classNames directly at compilation time, offering deduplication, eliminates of dead code and maintenability without sacrificing performances. IMHO a huge step in CSS development.