Skip to content

Commit 44c8013

Browse files
committed
valid html
1 parent 7183790 commit 44c8013

1 file changed

Lines changed: 26 additions & 30 deletions

File tree

README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,37 +63,33 @@ Here's a working app! It's just an HTML file, there is no build or tooling. You
6363
```html
6464
<!DOCTYPE html>
6565
<html lang="en">
66-
<head>
67-
<title>htm Demo</title>
68-
</head>
69-
<body>
70-
<script type="module">
71-
import { html, Component, render } from 'https://unpkg.com/htm/preact?module';
72-
73-
class App extends Component {
74-
addTodo() {
75-
const { todos } = this.state;
76-
this.setState({ todos: todos.concat(`Item ${todos.length}`) });
77-
}
78-
render({ page }, { todos = [] }) {
79-
return html`
80-
<div class="app">
81-
<${Header} name="MyApp: ${page}" />
82-
<ul>
83-
${todos.map(todo => html`
84-
<li>{todo}</li>
85-
`)}
86-
</ul>
87-
<button onClick=${this.addTodo.bind(this)}>Add Todo</button>
88-
<${Footer}>footer content here<//>
89-
</div>
90-
`;
91-
}
66+
<title>htm Demo</title>
67+
<script type="module">
68+
import { html, Component, render } from 'https://unpkg.com/htm/preact?module';
69+
70+
class App extends Component {
71+
addTodo() {
72+
const { todos } = this.state;
73+
this.setState({ todos: todos.concat(`Item ${todos.length}`) });
9274
}
93-
94-
render(html`<${App} page="To-Do's" />`, document.body);
95-
</script>
96-
</body>
75+
render({ page }, { todos = [] }) {
76+
return html`
77+
<div class="app">
78+
<${Header} name="MyApp: ${page}" />
79+
<ul>
80+
${todos.map(todo => html`
81+
<li>{todo}</li>
82+
`)}
83+
</ul>
84+
<button onClick=${this.addTodo.bind(this)}>Add Todo</button>
85+
<${Footer}>footer content here<//>
86+
</div>
87+
`;
88+
}
89+
}
90+
91+
render(html`<${App} page="To-Do's" />`, document.body);
92+
</script>
9793
</html>
9894
```
9995

0 commit comments

Comments
 (0)