4 ms·
> I really don't understand the hate for Web Components (this article is certainly not the first one to hate on it). - They completely ignore any and all devel
by troupo 3y ago
> I really don't understand the hate for Web Components (this article is certainly not the first one to hate on it).
- They completely ignore any and all developments in the user space
- They are bad for any of their stated purposes (of which there have been several)
- They require complex specs that make the platform more and more brittle, and impossible to reason about or implement. Most of those specs exists only because web components are so poorly designed they introduce problems no other tech in the space has.
- After over a decade in development they still need 20 more complex web specs to fix issues that, again, no one else has: https://w3c.github.io/webcomponents-cg/2022.html https://w3c.github.io/webcomponents-cg/2022.html And yes, this list only appeared in 2022 because it took the people who push them 10 years to finally come together and discuss what is needed to mark them as more-or-less complete
They will claim that "web coponents is 'use the platform'" even though it's trivial to show that web components are the worst citizens on said platform. I can't think of any tech that has been as ill-suited to the platform as web components [1]
- The previous bullet point exists because the entire development has been purely ad-hoc haphazard "we'll fix issues later" by people who continuously make a suprised pikachu face when stuff doesn't work even in the most simplest of scenarios that others have pointed out from miles away.
- Don't forget the complete arrogance of most people driving all this. They will deflect and ignore all questions and criticism, they will blame you, users, React, God, or anyone for not understanding their grand vision (that they themselves cannot explain) and for not using this. They will stoop as low as borderline gaslight even the people who work with them on developing this (reading through discussions on Constructible Stylesheets made me lose faith in humanity)
---
[1] https://threadreaderapp.com/thread/1717580502280867847.html https://threadreaderapp.com/thread/1717580502280867847.html
- afavour 3y agoIt seems you and the OP are discussing different platform levels. They use a framework like Lit and it abstracts away the complexity, leaving very simple deployment for end users. By comparison your complains seem like those faced by the kind of people making the Lit framework. IMO neither viewpoint is invalid.
- troupo 3y agoWell, the question was "I really don't understand the hate for Web Components". Once you've reached for a framework that papers over all the issues, and offers you a nice interface, it's no different if you reach for React, Preact, Vue, Svelte, or lit :)
- selectnull 3y agoI might be wrong, but the way I see it is that Web Components give the basic blocks of writing those frameworks easier. Of course, most of those frameworks are older than WCs and they made their own choices about how to implement components and probably (I don't really know) don't use WC (or use only parts of it). But, if someone wanted to make a new framework, today, I see no reason why they wouldn't use WCs. And let's not have an argument about JSX being a nicer developer experience, because sure it is nicer to use JSX and have autocompletion and all, but JSX does not run natively in the browser. WCs do. There are compromises.
- auggierose 3y agoWhat kind of functionality is "runs natively in the browser"? JSX also runs in every browser. Edit: Just rename "Web Components" into "Web Tags" and it's all good.
- selectnull 3y agoI don't know what browser you use, but when I do: const el = <p>Hello, world!</p>; I get `Uncaught SyntaxError: Unexpected token '<'`. I even tried in several browsers, no luck.
- auggierose 3y agoIt seems the problem here is not the browser, but your lack of knowledge.
- dtagames 3y ago
- baxuz 3y agoThe only good use cases for web components that I see is to use them for embedding encapsulated 3rd party widgets to prevent style contamination, kinda like iframes. Composing them is absolutely horrid, as is sharing data between them.
- tehbeard 3y agoAnother nice use is encapsulating custom form elements since they can natively provide a value to the form instead of needing a surrogate hidden field and all that entails. Embedding interactive content into a cms is I guess another surface but that's more semantic sugar and style encapsulation.