example/assets/js/app.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import h3, { createApp } from "./h3.js"; import AddTodoForm from "./components/addTodoForm.js"; import EmptyTodoError from "./components/emptyTodoError.js"; import NavigationBar from "./components/navigationBar.js"; import TodoList from "./components/todoList.js"; import store from "./store.js"; const app = () => { const { todos, filteredTodos, filter } = store.get(); store.dispatch("todos/filter", filter); localStorage.setItem("h3_todo_list", JSON.stringify(todos)); return h3("div#todolist.todo-list-container", [ h3("h1", "To Do List"), h3("main", [ AddTodoForm, EmptyTodoError, h3("div#main-area", [NavigationBar, TodoList]) ]) ]); } store.dispatch("todos/load"); const update = createApp('app', app); store.on('$update', update); |