4 ms·
Most of this Article focuses on the argument that you can use CSS classes for code deduplication. > There is no need to write a component for every situation b
by SebastianKra 3y ago
Most of this Article focuses on the argument that you can use CSS classes for code deduplication.
> There is no need to write a component for every situation because you can use external CSS
Unless you're writing the most basic document-type html, this is awful advice.
Even the tiniest widgets can be subject to a structural change. I can only think of the line: "Implement Select, 2000 issues" [1]
Admittedly, CSS can correct the structure in some cases. Grid gives us more control over the arrangement, :before and :after can add elements... but in the end, you're just praying that you won't run into a requirement for which you need to update 200 html instances. The realisation that styling is inherently coupled to the structure, and that you will rarely have two components with both identical structure and style, is why css is generally scoped to each component.
For anything that is scoped globally, use a component.
[1]: I forgot where I picked this up, could've been a video for Radix-UI.