Home / Function/ createTodo() — react Function Reference

createTodo() — react Function Reference

Architecture documentation for the createTodo() function in actions.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  67839966_656d_4d7f_15a9_1b31f519e7bb["createTodo()"]
  a2e3768b_191e_9986_afcb_87f97e20160d["actions.ts"]
  67839966_656d_4d7f_15a9_1b31f519e7bb -->|defined in| a2e3768b_191e_9986_afcb_87f97e20160d
  98842fa7_bb50_842d_f839_f1155cf8c2a5["getTodos()"]
  67839966_656d_4d7f_15a9_1b31f519e7bb -->|calls| 98842fa7_bb50_842d_f839_f1155cf8c2a5
  style 67839966_656d_4d7f_15a9_1b31f519e7bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/flight-parcel/src/actions.ts lines 28–42

export async function createTodo(formData: FormData) {
  let todos = await getTodos();
  let title = formData.get('title');
  let description = formData.get('description');
  let dueDate = formData.get('dueDate');
  let id = todos.length > 0 ? Math.max(...todos.map(todo => todo.id)) + 1 : 0;
  todos.push({
    id,
    title: typeof title === 'string' ? title : '',
    description: typeof description === 'string' ? description : '',
    dueDate: typeof dueDate === 'string' ? dueDate : new Date().toISOString(),
    isComplete: false,
  });
  await fs.writeFile('todos.json', JSON.stringify(todos));
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does createTodo() do?
createTodo() is a function in the react codebase, defined in fixtures/flight-parcel/src/actions.ts.
Where is createTodo() defined?
createTodo() is defined in fixtures/flight-parcel/src/actions.ts at line 28.
What does createTodo() call?
createTodo() calls 1 function(s): getTodos.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free