MCPcopy Create free account
hub / github.com/NativeScript/template-macos-solid / addTodo

Function addTodo

src/examples/todo.tsx:35–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 let textField: HTMLTextFieldElement | null = null;
34
35 function addTodo() {
36 setTodos((prev) => {
37 const next = [...prev];
38 next.push({
39 id: next.length + 1,
40 title: newTodo,
41 completed: false,
42 });
43 storageApi.set("todos", JSON.stringify(next));
44 newTodo = "";
45 textField?.clear();
46 return next;
47 });
48 }
49
50 createRenderEffect(() => {
51 setTimeout(() => {

Callers 1

TodoMVPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected