Comment by davepeck

Comment by davepeck 3 days ago

0 replies

I may be the wrong person to answer, alas. I nearly entirely avoid the machinery of web components.

With the stack above, I typically write small classes that derive from HTMLElement and implement a couple key callbacks (usually, connectedCallback and disconnectedCallback). In those, I typically (a) initialize state by reading attributes from the DOM and (b) configure event handlers. Pretty simple.

That's... about it. I'm templating elsewhere, so I avoid using web component templates. And the less I think about the shadow DOM, the better.

For this, the MDN documentation on custom components is enough.