all repos — h3 @ 2f752ccce57c904ff1272be4b6bcc3215374a413

A tiny, extremely minimalist JavaScript microframework.

example/assets/js/components/addTodoForm.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
import h3 from "../h3.js";

export default function AddTodoForm(actions) {
  const { addTodo, addTodoOnEnter, updateError, updateMainSection } = actions;
  return h3("form.add-todo-form", [
    h3("input", {
      id: "new-todo",
      placeholder: "What do you want to do?",
      autofocus: true,
      onkeydown: (event) => addTodoOnEnter(event, updateError, updateMainSection),
    }),
    h3(
      "span.submit-todo",
      {
        onclick: () => addTodo(updateError, updateMainSection),
      },
      ["+"]
    ),
  ]);
}