3 ms·
As far as I can see, web components take only strings as arguments. That alone disqualifies them from being a serious component framework. I've looked at them o
by auggierose 3y ago
As far as I can see, web components take only strings as arguments. That alone disqualifies them from being a serious component framework. I've looked at them only for a short time last month, because I was excited about a web native component framework, but they provide basically nothing I would expect from such a framework. They are not even in the same arena as React.
- WickyNilliams 3y agoStrings as _attributes_, yes. But that's par for the course when it comes to html (boolean attributes aside). However, anything can be passed as a _property_. React operates on properties by default (hence `htmlFor` and `className`, not `for` and `class`). In fact, react's upcoming improved WC support will first do an `in` check on a property name before falling back to attribute. This is similar in vue etc. So yes if you're only authoring plain html you're confined to primitives, but if you're using a framework or WC lib, they almost certainly support properties
- auggierose 3y agoI see, interesting. That's certainly helpful. Still, I don't see what problem web components solve. New custom html tags? Nice, but useless. And if I have to use a framework or WC lib on top of web components... Well. Nothing gained, it is just switching one framework for another. I am not against that at all, in fact I am writing my own framework for specific reasons. But let's not pretend that web components are a solution to anything, or that there are specific reasons why it needs to exist.
- djrenren 3y ago> They are not even in the same arena as React. This is 100% correct. I think a lot of the disappointment about web components comes from a mismatch in expectation between the spec writers and what people when they think "components". Web Components allow you to make new HTML elements. That is, you can make new kinds of DOM nodes out of other DOM nodes. This is powerful, but the resultant API is still a DOM-level API, and not a full templating system like React. On the other hand, because all these templating systems (React, lit, svelte, etc.) ultimately boil down to a series of DOM manipulations, this allows you to create a kind of element that can be plugged into all of these systems. Custom elements are a lot more akin to the C ABI. Than a fully featured framework.