3 ms·
Webcomponents are a pain in the ass to make, though. That is, sufficiently complex ones. I wish there was an easier way.
by junon 10mo ago
Webcomponents are a pain in the ass to make, though. That is, sufficiently complex ones. I wish there was an easier way.
- emseetech 10mo agoThey could have better ergonomics and I hope a successor that does comes out but they're really not that bad.
- brazukadev 10mo agoweb components need 2 things to be great without external libraries (like lit-html): - signals, which is currently Stage 1 https://github.com/tc39/proposal-signals https://github.com/tc39/proposal-signals - And this proposal: https://github.com/WICG/webcomponents/issues/1069 https://github.com/WICG/webcomponents/issues/1069 which is basically lit-html in the browser
- junon 10mo agoIt's a shame Surplus (Adam Haile's, not my succession of it) isn't cited nor is he mentioned, given that at least two of the listed frameworks were heavily and directly inspired by his work. S.js is probably one of the most incredible JavaScript libraries I've used that should be the reference for a signal API, in my opinion.
- eric-p7 10mo agoI've built Solarite, a library that's made vanilla web components a lot more productive IMHO. It allows minimal DOM updates when the data changes. And other nice features like nested styles and passing constructor arguments to sub-components via attributes. https://github.com/Vorticode/solarite https://github.com/Vorticode/solarite
- jeswin 10mo agoIt's ok now, at least for me. There are still challenges around theming and styling because of styling boundaries (which makes Web Components powerful, but still). A part of it is about tooling, which can be easier to improve. Try my tiny web components lib if you want to keep JSX but not the rest of React: https://github.com/webjsx/magic-loop https://github.com/webjsx/magic-loop
- gedy 10mo agoSvelte has a pretty nice support for this via https://svelte.dev/docs/svelte/custom-elements https://svelte.dev/docs/svelte/custom-elements It's not a no-build option though.
- WorldMaker 10mo agoI find Web Components aren't as much of a pain to write if you ignore the Shadow DOM. You don't need the Shadow DOM, it is optional. I don't think we are doing ourselves too many favors in how many Web Component tutorials start with or barrel straight into the Shadow DOM as if it was required.