all repos — h3 @ 9be48a7e0f62afde109af560909ba9895c8cedf9

A tiny, extremely minimalist JavaScript microframework.

example/assets/js/components/todoList.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
import h3 from "../h3.js";
import Todo from "./Todo.js";

export default function TodoList() {
  const { page, pagesize } = h3.state;
  const filteredTodos = h3.state.filteredTodos;
  const start = (page - 1) * pagesize;
  const end = Math.min(start + pagesize, filteredTodos.length);
  return h3(
    "div.todo-list",
    filteredTodos.slice(start, end).map(Todo)
  );
}