MCPcopy Create free account
hub / github.com/TanStack/db / handleSubmit

Function handleSubmit

examples/react/todo/src/components/TodoApp.tsx:101–115  ·  view source on GitHub ↗
(e: FormEvent)

Source from the content-addressed store, hash-verified

99 }
100
101 const handleSubmit = (e: FormEvent) => {
102 e.preventDefault()
103 const todo = newTodo.trim()
104 setNewTodo(``)
105
106 if (todo) {
107 todoCollection.insert({
108 text: todo,
109 completed: false,
110 id: Math.round(Math.random() * 1000000),
111 created_at: new Date(),
112 updated_at: new Date(),
113 })
114 }
115 }
116
117 const activeTodos = todos.filter((todo) => !todo.completed)
118 const completedTodos = todos.filter((todo) => todo.completed)

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected