I'm assuming you mean "when an" event is fired right?
Just call render again with the same template in your event handler.
@fafcrumb,
I have modular components, so I can't reference it externally. How can I do it internally, like React's setState?
For example,
// incrementor
export default = () => {
let i = 0;
const handleClick = () => {
i++;
// re-render me, please!
};
return html`
<div>
<span>${i}</span>
<button on-click="${handleClick}">CLICK ME</button>
</div>
`;
}
That example isn't a component, just a template. Are you using something for a component model?
In LitElement for example you'd call this.invalidate().
Got it! Thanks, @justinfagnani @fafcrumb! I'm studying lit-html to create a simpler component model using Gesco.
The answer to this question has changed, for LitElement this now appears to be this.requestUpdate()
Thanks for the edit @KeithHenry ;)
Most helpful comment
The answer to this question has changed, for
LitElementthis now appears to bethis.requestUpdate()