3 ms·
How do you manage changing state overtime? Do you re-render the whole template? Can templates be nested?
by justsomeuser 4y ago
How do you manage changing state overtime? Do you re-render the whole template?
Can templates be nested?
- r3trohack3r 4y agoYou 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.