Input
loadTodos() resolves with [{ id: 1, text: 'Buy milk' }, { id: 2, text: 'Walk dog' }]Output
Two todo-item elements are rendered: 'Buy milk' and 'Walk dog'
Build the UI for a todo app whose data lives in a backend. You're given three async props that stand in for the API: `loadTodos()` returns the current list, `addTodo(text)` creates a todo on the server and returns it, `...
App.tsxEditable starterloadTodos() resolves with [{ id: 1, text: 'Buy milk' }, { id: 2, text: 'Walk dog' }]Two todo-item elements are rendered: 'Buy milk' and 'Walk dog'
User types 'Pay rent' and clicks add. addTodo('Pay rent') resolves with { id: 3, text: 'Pay rent' }A third todo-item with 'Pay rent' appears in the list
How would you handle a failed `addTodo` — show an inline error, retry, or roll back optimistically?