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

Where’s a good place to learn about the web components aspect? I’ve tried a few times (and the shoelace docs) but it doesn’t stick.


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.




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

Search: