repl.it
@todojs/

06-lit-html

HTML, CSS, JS

No description

fork
loading
Files
  • index.html
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Template</title>
</head>
<body>
<button>Change</button>
<div id="result"></div>
<script type="module">
  import { html, render } from 'https://unpkg.com/lit-html?module';

  let sayHello = (name) => html`<h1>Hello ${ name }</h1>`;
  render (sayHello ('World'), document.querySelector('#result'));

  document.querySelector('button').addEventListener('click', () => {
    render (sayHello ('Everyone'), document.querySelector('#result'));
  });
</script>
</body>
</html>
result
console
?