function TodoList() {
const todos = signal([]);
const text = signal("");
const setText = (e) => (text.value = e.target.value);
const addTodo = (e) => {
e.preventDefault();
if (text.value === "") return;
todos.value = todos.value.concat({ text: text.value });
text.value = "";
};
return html`
<form onsubmit=${addTodo}>
<label>
<div><b><small>Add to-do:</small></b></div>
<input value=${text} oninput=${setText} />
</label>
<button type="submit">Add</button>
<ul>
${computed(() =>
todos.value.map((todo) => html`<li>${todo.text}</li>`)
)}
</ul>
</form>
`;
}