logoalt Hacker News

junonlast Sunday at 11:30 PM4 repliesview on HN

Webcomponents are a pain in the ass to make, though. That is, sufficiently complex ones. I wish there was an easier way.


Replies

eric-p7yesterday at 2:51 AM

I'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

jeswinyesterday at 2:55 AM

It'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

prisencolast Sunday at 11:32 PM

They could have better ergonomics and I hope a successor that does comes out but they're really not that bad.

show 1 reply
gedyyesterday at 2:28 PM

Svelte has a pretty nice support for this via https://svelte.dev/docs/svelte/custom-elements

It's not a no-build option though.