Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How do you feel that web components are heavy? They're a pretty small set of low level APIs, and being native they have no download cost.

They're also pretty unopinionated. They only let you define an HTML element and hook it's lifecycle. They let you know where to render (the element instance and it's shadow root), and when to do things (lifecycle). The rest is up to developers, and there are lots of helper libraries with different opinions on how to implement a full element.

I think you'll find that some of them, like lit-html, LitElement, and Haunted, have very similar ergonomics and models to React. And much better performance and bundle sizes.



>How do you feel that web components are heavy? They're a pretty small set of low level APIs, and being native they have no download cost.

This is a weird misnomer to me. Stuff that's provided by the browser is not magically faster or better. Further, native browser functionality can slow down applications just by existing, like for example Mutation Events (which were removed in favor of Mutation Observers.)

In that sense I really dislike what functionality is being loaded onto HTML elements, effectively the lowest level primitive of web apps.

>They're also pretty unopinionated. They only let you define an HTML element and hook it's lifecycle.

In itself, there's not a whole lot wrong with this... But as fate would have it, the idea that HTML elements themselves should be components is an opinion hotly debated. In Angular 2, you have both directives, AND components that are selected from attributes. In React, the component tree is a fully separate entity from the DOM tree, and components don't even appear in the DOM.

To me these are not small details that can be reconciled. Part of what makes React ergonomically nice is that it can generate a nice, clean DOM free of component cruft and scoped CSS or whatever.

>And much better performance and bundle sizes.

Modern JS app performance is just not that simple. We've got server side rendering with hydration, scheduling rendering asynchronously for better responsiveness, bundle splitting, etc. Simply saying "WebComponents are better because they're faster" means little to me. Is my app bottlenecking on React? Often it's really not.

And if React's ~100kb is really killing you, there's plenty of libraries that implement just the basics in much less. Preact is quite good.


> And much better performance and bundle sizes.

I understand that you're the author of lit-html - would you say that the above is the main selling point of it?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: