top | item 35195870

(no title)

justsomeuser | 3 years ago

How do you manage changing state overtime? Do you re-render the whole template?

Can templates be nested?

discuss

order

r3trohack3r|3 years ago

You use standard DOM operations to update state, like innerText and classList.add, defined inside the JS class that orchestrates the component.

Nesting works using the same concept. A parent template either picks one of its child nodes using this.fragment.querySelector or using document.createElement to mount a child template to. You then use this.addChild to opt into garbage collection.