Live data from Hacker News

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

daverupert.com

61–70 of 189 posts

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

#62

Earlier quoted context omitted.

Web components are really only useful for stuff that's dynamic, like a sortable table that fetches data from an AJAX request. They require javascript and have no fallback or graceful degradation in functionality at all, which means using web components for all your bog standard buttons, text content, headers, etc. could be a very bad idea (not to mention it would trash the SEO and potentially accessibility of your si…

> They require javascript and have no fallback or graceful degradation in functionality at all This is false. Use and . First-class progressive enhancement.

Have you ever seen an example of this in the wild?

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

#63
post #29

IMO the main reason more people aren’t using Web Components is because React doesn’t support them. Preact does it just fine so I have to assume it’s possible but simply not in the interests of the React team. React feels like the enterprise lock-in of 2020s development: if you use it you’re using it top to bottom and it’s very difficult to mix and match with other frameworks. It’s a shame.

Where do you see React doesn’t support web components?.. also many frameworks have wrappers around web components specifically for frameworks like Vue and React for things like passing other values than strings.

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

#65

Earlier quoted context omitted.

Web components are extremely useful even without customized built-ins. And Apple is open to alternatives.

I don't disagree about the first part, but it is nevertheless the reason I'm not using them, since I have a very general use case (c.f. https://github.com/hotwired/turbo/pull/131 ). As for representing Apple's state of mind w.r.t. alternatives; they've had the better part of a decade to shit or get off the pot, so I don't hold a shred of vendor sympathy. In that context, "open to alternatives" just sounds like produc…

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, template instantiation, etc., in the mean time.

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

#66
You used to need a whole js build system because old browsers were still out there. With the death of IE11 and the death of non blink Edge, basically every current browser finally supports the full api. But this happened when functional js is the big thing and being class based the custom element api isn't as popular as it should be.

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

#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 users, would ever benefit from this complexity, given that a lot of them don't seem to have problems that are solved by web components.

If we were going to focus on adding even more new browser features, I think it'd be better to focus on stuff that helps close cross-site scripting vulnerabilities, or provide better approaches towards anti-SPAM/anti-abuse than lazy, harmful remote attestation. (I mean hell, I'd love to see some very basic hashcash functionality as part of the browser; Personally, I think that would be an interesting idea for anti-SPAM, and nowhere near as catastrophically harmful as WEI.)

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

#68
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.

Fully agreed.

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

#69

Earlier quoted context omitted.

I don't disagree about the first part, but it is nevertheless the reason I'm not using them, since I have a very general use case (c.f. https://github.com/hotwired/turbo/pull/131 ). As for representing Apple's state of mind w.r.t. alternatives; they've had the better part of a decade to shit or get off the pot, so I don't hold a shred of vendor sympathy. In that context, "open to alternatives" just sounds like produc…

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.

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

#70

Earlier quoted context omitted.

> They require javascript and have no fallback or graceful degradation in functionality at all This is false. Use and . First-class progressive enhancement.

Have you ever seen an example of this in the wild?

Sometimes, but not enough. Everyone tries to write web components like it's "Open Standards React Lite". And the results are as poor as expected.

Web components are superficially similar to React/Angular/Vue, but very different in practice. Different strengths. Different use cases. Different opportunities. Like the post says, the web components community has been terrible at articulating and marketing these differences.

Post reply on HN