3 ms·
Maybe a bit pedantic - but I prefer using lit-html, not lit. Lit is a bit too "frameworky" for my taste, I generally just use vanilla classes that extend HTMLE
by claytongulick 3y ago
Maybe a bit pedantic - but I prefer using lit-html, not lit.
Lit is a bit too "frameworky" for my taste, I generally just use vanilla classes that extend HTMLElement and have a render function that renders the lit-element template to the light dom.
Something like:
import {html, render} from 'lit-html';
class AppComponent extends HTMLElement {
connectedCallback() {
this.template = () => html`<markup here>`;
this.render();
}
render() {
if(this.template)
render(this.template(), this)
}
}
customElements.define('app-component', AppComponent);
- itslennysfault 3y agoPerfect, and perfect timing. I was recently tasked with creating a small standalone web app and everything feels like overkill to me. This might be the perfect fit. Thanks for the explanation.