Skip to content

Instantly share code, notes, and snippets.

@peschee
Last active August 31, 2020 09:01
Show Gist options
  • Save peschee/e051c870a0354e4013d55351e6e8fe31 to your computer and use it in GitHub Desktop.
Save peschee/e051c870a0354e4013d55351e6e8fe31 to your computer and use it in GitHub Desktop.
lit-html Count Example
import { html, render } = from 'lit-html';
// A lit-html template uses the `html` template tag:
const countTemplate = (count) => html`<p>The current count is: ${count}</p>`;
let i = 0;
setInterval(() => {
// Renders with the `render()` function
// + re-renders only update the data that changed, no VDOM diffing!
render(countTemplate(i++), document.body)
}, 1000);
@peschee
Copy link
Author

peschee commented Aug 31, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment