Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML...
by mixmastamyk on Tuesday September 17, 2024 @12:38PM
(#41569581)
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.
[ Parent
| on HN ]
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML...
by davepeck on Tuesday September 17, 2024 @12:54PM
(#41569783)
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.