function List() {
const [tasks, setTasks] = useState([]);
const [task, setTask] = useState("");
function addTask(event) {
if (event.key === "Enter") {
console.log(task);
}
setTask("");
}
return (
<div>
<h1>Ваши задачи</h1>
<input
className="input"
type="text"
value={task}
placeholder="Добваить задачу"
onChange={(e) => setTask(e.target.value)}
onKeyDown={addTask}
/>
<ul className="list">
<li>
<Task />
</li>
<li>
<Task />
</li>
</ul>
</div>
);
}