import React, { useState } from "react"; import Todo from "./Todo"; type TodoListProps = { todos: Todo[]; }; const TodoList: React.FC = ({ todos }) => { const [todos, setTodos] = useState([]); const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); const formData = new FormData(event.target as HTMLFormElement); const text = formData.get("text") as string; setTodos([...todos, { id: todos.length + 1, text, completed: false }]); }; return (
    {todos.map((todo) => (
  • ))}
); }; export default TodoList;