3 ms·
> why does basically no one ever write directly to the Web Components standard? Web components provide a life cycle (mounted, unmounted, attribute changed) and
by azangru 3y ago
> why does basically no one ever write directly to the Web Components standard?
Web components provide a life cycle (mounted, unmounted, attribute changed) and an encapsulation mechanism; but they aren't reactive. They don't rerender when you change an attribute or a property. They don't have a concept of local state, whose changes would result in a rerender. Html templates don't have a convenient syntax for binding properties or events. Lit adds all this convenience, with very little code. The result is that the web components that it produces remain standard and interoperable, but are also much more pleasant to author than plain components.