2 ms·
Strings 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_.
by WickyNilliams 3y ago
Strings 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.