Build a functional todo list component where users can add new tasks and remove existing ones.
QuizMaster provides basic styling for common HTML elements. Toggle between 'Styled' and 'Raw' modes in the preview panel to see your component with or without platform styling.
<div>
<h1>Todo List</h1>
<div className="input-container">
<input
type="text"
placeholder="Add your task"
value={newTask}
onChange={(event) => setNewTask(event.target.value)}
/>
<button onClick={handleAddTask}>Submit</button>
</div>
<ul>
{tasks.map((task, index) => (
<li key={index}>
{task}
<button onClick={() => handleDeleteTask(index)}>Delete</button>
</li>
))}
</ul>
</div>