You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to implement something similar but without webcomponents. A simple function that renders some templateResult, having its own variables and functions.. I came up with a function like this
dummy.component.js:
import{html}from'lit-html';exportdefaultfunctiondummyComponent(updateHandler){console.log("Dummy componenting...");varcounter=0;functionincrement(){console.log("incrementing..")counter++;updateHandler();}vartemplateResult=html` Hello ${name}, I am dummy @ ${counter}<buttontype="button" onclick="${()=>{increment()}}">Increment</button> `returntemplateResult;}
And to render it, I simply put it inside another templateResult
Hi,
I was trying to implement something similar but without webcomponents. A simple function that renders some templateResult, having its own variables and functions.. I came up with a function like this
dummy.component.js:
And to render it, I simply put it inside another templateResult
ui.js:
and finally
app.js
this does not work because everytime updateTemplateResult is called, the dummycomponent is re-created and hence the counter goes back to zero.
is this the kind of problem to use webcomponents instread of simple javascript functions to create reusable components?
I know that is not an issue with your library, I just wanted to try my chance! Thanks in advance
The text was updated successfully, but these errors were encountered: