logoalt Hacker News

etchalonyesterday at 5:29 PM2 repliesview on HN

A handful of benefits:

1. Specificity - swim-line.buttons vs .swin-lines.buttons vs .buttons.swim-lanes. 2. Future pathing - Maybe you don't need a Web Component today, but you might need one tomorrow. 3. Cleaner - <swim-lane /> is just better than <div class="swim-lane" />


Replies

pier25yesterday at 9:28 PM

> Specificity

:where() gives you zero specificity.

> Future pathing

Sounds like premature optimization. And I say this as someone who has been using custom elements and web components in production since 2016. In fact one of my products offers WCs for our customers:

https://docs.wavekit.app/web-components-wavekit-audio/

> Cleaner

Debatable. Personally I find it cleaner to simply rely on CSS to solve something rather a combination of CSS, JS, and some custom markup.

show 1 reply
smrqyesterday at 6:59 PM

"Clean" is the biggest lie in software development. It's an aesthetic opinion dressed up as objective fact. You think components are clean, someone else thinks classes are clean, and neither of you are wrong, except for believing that "clean" is a property of the code and not something entirely in your own mind.

show 1 reply