Live data from Hacker News

If Web Components are so great, why am I not using them?

daverupert.com

71–80 of 189 posts

Re: If Web Components are so great, why am I not using them?

#71
post #14

Earlier quoted context omitted.

When you see this, it’s a sign that someone built their web components with React/Angular/Vue on the brain. The tech is fine. You can achieve amazing progressive enhancement with web components by understanding and effectively using and . However, many web component developers never learn this. The problem you’re describing is a training/marketing issue, as discussed in the post.

The browsers really need to make it possible to use templates and slots without javascript at all. There's no reason I shouldn't be able to define and use a custom element using HTML alone. Until then I don't know if template and slot will take off.

We had HTML imports and they got rid of it. No JS means No Ads.

Re: If Web Components are so great, why am I not using them?

#72

The main reason is that they're too low-level to use directly. They do a lot, but stop just short of being useful without something of a framework on top. I tried hard to use them directly, but found that it was untenable without sensible template interpolation, and without helpers for event binding. Here's my shot at the smallest possible "framework" atop Web Components that make them workable (and even enjoyable) a…

Yeah, that's where I'm at, too. Authoring web components directly is too low level to be practical. You can easily end up reimplementing a ton of existing framework logic around rerenders, reactivity, event handlers, etc.

And there are libraries that handle all of this for you! But then you have tooling and non-standard syntax that puts you a lot closer to other JS frameworks.

And once you're in that space, the benefits of web components may or may not stack up against all the features and your team's pre-existing knowledge.

Re: If Web Components are so great, why am I not using them?

#73
post #71
post #14

Earlier quoted context omitted.

The browsers really need to make it possible to use templates and slots without javascript at all. There's no reason I shouldn't be able to define and use a custom element using HTML alone. Until then I don't know if template and slot will take off.

We had HTML imports and they got rid of it. No JS means No Ads.

It means less invasive tracking really, not no ads.

Ironically it was Firefox that killed it, not Google. Google was all in on HTML imports. It would have also given a non JS way to dynamically load HTML. Streaming would have been great with this.

Re: If Web Components are so great, why am I not using them?

#74

Earlier quoted context omitted.

I don't think Apple sees themselves as _needing_ to shit or get off the pot. They made their opposition to customized built-ins, and their reasoning, known from the beginning, and Chrome and Firefox proceeded anyway. From Apple's point-of-view they're probably waiting for someone to propose a solution that doesn't have the same perceived issues. They've been doing good work on declarative shadow DOM, selection, a11y,…

> I don't think Apple sees themselves as _needing_ to shit or get off the pot. Indeed, judging from both words & (in)actions, I think we can safely conclude that they don't. There's likely no direct commercial pressure to implement this part of the standard, and I'd expect all members of WHATWG's steering group perceive the vast influence they consequently hold as a competitive advantage, not a social contract.

I don't quite understand that last bit. Apple objected to this part of the standard, but since WHATWG doesn't work on a consensus model like TC39, they don't have an official way to block. So they registered their rather strong objection - including that they have no intentions to implement it - the feature got merged over their objections, and everyone moved on with the rest of the specs.

I'm not sure what competitive advantage that gains them or anyone else. There's an impasse, and effectively no one uses this feature.

Re: If Web Components are so great, why am I not using them?

#75

The main reason is that they're too low-level to use directly. They do a lot, but stop just short of being useful without something of a framework on top. I tried hard to use them directly, but found that it was untenable without sensible template interpolation, and without helpers for event binding. Here's my shot at the smallest possible "framework" atop Web Components that make them workable (and even enjoyable) a…

That approach destroys and rebuilds the entire DOM on every render. This would not work for large compound components and apps.

Re: If Web Components are so great, why am I not using them?

#76

Web components are doing really well: they're used on > 18% of Chrome page views, huge apps like Photoshop, parts of Chrome, Chrome OS, and Firefox, more and more of Reddit, and tons of design systems are built with them, and Lit has far more weekly npm downloads than Svelte or Solid.

We're a fairly large , publicly traded org that no one has ever heard of but almost everyone interacts with our products. All our frontend products are entirely web-components (Lit). I like them. Used stencil before this at another job and it was also just fine.

Re: If Web Components are so great, why am I not using them?

#78
This article doesn't really follow the title? I was expecting some critique of existing software and why someone prefers alternatives. Instead, I got a list of excuses on why people haven't really looked at it.

Not that any of the points are bad. As read, they all seem like solid reasons to not use something. Indeed, the fact that frameworks have no reason to use these over user space constructs seems very compelling, all on its own.

The rest feels like a thinly veiled rewording of the second point? That is, this feels like advocacy that is blaming the messengers for not successfully convincing us that we should use this superior thing. Which... is still a heavy handed advocacy. :(

Re: If Web Components are so great, why am I not using them?

#79
post #67

I think Web Components added a lot of complexity to the web platform again and we're finally hitting the breaking point where it has gotten to be too much. I don't want to deal with web components or the shadow DOM. I don't want more abstractions in the browser at this point. On one hand, there are some use cases for this new complexity. On the other hand, it's difficult to see how the vast majority of say, React use…

I would agree and would rather they had spent more effort on adding support via standard HTML5 elements for more of the standard native form widgets like comboboxes, tree controls, grid controls, etc. - all those things that already exist on almost every platform but keep having to be reinvented in javascript for no good reason.

Web Components mostly seem to be just adding complexity for the sake of avoiding simplicity.

Certainly there could be some use for custom ones, just as you can make custom native widgets. But there shouldn't be that much need that often if more of the standard functionality was available (and standard).

They did add color picker, date picker, range, and the datalist to kind of sort of emulate a combobox, so some credit for that. But unfortunately they're not consistent across browsers and may or may not be consistent with the native platform.

Re: If Web Components are so great, why am I not using them?

#80

Earlier quoted context omitted.

> I don't think Apple sees themselves as _needing_ to shit or get off the pot. Indeed, judging from both words & (in)actions, I think we can safely conclude that they don't. There's likely no direct commercial pressure to implement this part of the standard, and I'd expect all members of WHATWG's steering group perceive the vast influence they consequently hold as a competitive advantage, not a social contract.

I don't quite understand that last bit. Apple objected to this part of the standard, but since WHATWG doesn't work on a consensus model like TC39, they don't have an official way to block. So they registered their rather strong objection - including that they have no intentions to implement it - the feature got merged over their objections, and everyone moved on with the rest of the specs. I'm not sure what competiti…

[deleted]
Post reply on HN