|
|
|
|
|
by city41
1629 days ago
|
|
But why do it with extra elements? The child should accept a class or possibly styles and the parent decides what those are. Child directly styles itself with color, font, internal layout, etc Parent positions child with flex box, grid, margin or absolute positioning. Spacer elements are not needed at all. |
|
You could do it that way too. However, when you reply on your component system to help assemble a UI, the components take on the encapsulation role you’d use rich selectors for in other situations. A layout component performs the same function as a utility css class, but is more idiomatic.