// src/App.jsx import { useReducer } from "react"; function todosReducer(state, action) { switch (action.type) { case "add": return [...state, { id: action.payload.id, text: action.payload.text, done: false }]; case "toggle": return state.map((todo) => todo.id === action.payload.id ? { ...todo, done: !todo.done } : todo ); case "remove": return state.filter((todo) => todo.id !== action.payload.id); default: return state; } } function TodoList() { const [todos, dispatch] = useReducer(todosReducer, []); function handleAdd(text) { dispatch({ type: "add", payload: { id: Date.now(), text } }); } return (