If you look at the code in Tiny, youβll notice we run four lines of code every time we render a component β regardless whether itβs the main component or descendants.
These are the three lines of code we run:
_render(comp)_addEventListeners(comp)_renderChildComponents(comp)We can put _addEventListeners and _renderChildComponents inside _render so we only have to write one line.
function _render(comp) { comp.element.innerHTML = comp.template() _addEventListeners(comp) _renderChildComponents(comp)}Iβd leave you to remove the extra lines from the rest of your code :)
Welcome! Unfortunately, you donβt have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson