For example, there’s a component called “InlineStack” which is just a javascript wrapper for a div with flex. This stuff drives me nuts.
For example, there’s a component called “InlineStack” which is just a javascript wrapper for a div with flex. This stuff drives me nuts.
[0]: https://github.com/Shopify/polaris/blob/eb6161f6b4e02679b5e8...
Compare the following:
<Stack gap={2} direction="row">
<Box>
<Avatar />
</Box>
<Box>
<Button />
</Box>
</Stack>
-----
<MyCustomWrapper>
<InnerChild>
<Avatar>
</InnerChild>
<InnerChild>
<Button />
</InnerChild>
</MyCustomWrapper> <div className=“flex gap-2”>
<Button/>
<Avatar/>
<\div>
Then just apply the box styles using *: selector or directly in the componentWhile I understand the gut reaction to seeing something like InlineStack, it’s not any different than a utility class except the abstraction has been made on the component level instead of the CSS level within a bunch of different components. The other thing is that these types of components provide a layer for abstraction that extends beyond the web. If I’m writing a app that targets web and native mobile, I can let the compiler decide which version to place in the build to take advantage of native features of the platform.
At a certain scale, programming becomes about maintaining consistency at said scale and less about the craftsmanship of an individual component. As a developer who also enjoys writing CSS and building layouts myself by hand, I understand your frustration but it’s misguided towards a group of developers who are trying to solve different problems.
We don’t need to implement everything that FAANG comes up with in their “innovation labs” and I 100% believe that there is a place for handcrafted code in applications for decades to come. But let’s not lose site of the fact that table saws haven’t replaced hand saws. They serve different purposes for different audiences and that’s okay!
But I have to know that stars represent html italic tags (and bunches of other stuff).
Thankfully this has been standardised and every markdown parser knows what stars mean. So I only have to learn this once.
Most frameworks haven’t been standardised and that’s where the frustration lies.
Abstraction is good when it becomes a commonality, bad when it remains niche.
Semantics is at some point arbitrarily agreed upon and memorized.
This is one of the biggest pros for Tailwind, is that it leads people away from this misbegotten mindset. The scare quotes around "semantic" are right. It's amazing how many of the same people stress separation of concerns to separate content from presentation, then turn around and name the presentation after the content.
If the class name is not enough for me to guess, I just hover the class name and the LSP will show me the applied styles.
Another issue is that Shopify changes the name of these components for no reason, for example InlineStack was once called Inline, then HorizontalStack, then InlineStack, while the flex box model hasn’t change since 2012
Semantics evolve over time. This is true of natural language and coding practice.