3 ms·
I don't find WebComponents a good replacement for what in other web frameworks are called components. For one thing they don't support complex values like Objec
by FjordWarden 1y ago
I don't find WebComponents a good replacement for what in other web frameworks are called components. For one thing they don't support complex values like Objects and Arrays as attributes. The amount of boilerplate you have to write is way too high, and you still don't have reactivity. I do vanilla-ish JS using signals[1]. Not everything the W3C releases should be canon, XHTML is a testament to that.
[1] https://wrnrlr.github.io/prelude/ https://wrnrlr.github.io/prelude/
- jonahx 1y agoSee also: Meiosis Pattern: https://meiosis.js.org/docs/01-introduction.html https://meiosis.js.org/docs/01-introduction.html Mithril: https://mithril.js.org/ https://mithril.js.org/
- WorldMaker 1y agoA lot of the "boilerplate" of WebComponents disappears if you entirely ignore the Shadow DOM, and you can just do that. They can support objects and arrays as attributes in the same way as the old Progressive Enhancement era (jQuery/Knockout-era) web: via data- attributes and the dataset property. Similar to that era you probably still want to support JSON serialization/deserialization to those attributes for SSG/SSR support.