diff --git a/src/Components/TodoList.jsx b/src/Components/TodoList.jsx
index a3f8bffe..4bf7c4e8 100644
--- a/src/Components/TodoList.jsx
+++ b/src/Components/TodoList.jsx
@@ -2,27 +2,80 @@ import React, { useState } from 'react';
import './TodoList.css';
const TodoList = () => {
-
+ const [todos, setTodos] = useState([]);
+ const [headingInput, setHeadingInput] = useState('');
+ const [listInputs, setListInputs] = useState({});
- return (
- <>
-
-
My Todo List
-
-
-
-
-
-
-
-
- >
- );
+ const handleAddTodo = () => {
+ if (headingInput.trim() !== '') {
+ setTodos([...todos, { heading: headingInput, lists: [] }]);
+ setHeadingInput('');
+ }
+ };
+
+ const handleDeleteTodo = (index) => {
+ const newTodos = [...todos];
+ newTodos.splice(index, 1);
+ setTodos(newTodos);
+ };
+
+ const handleAddList = (index) => {
+ if (listInputs[index] && listInputs[index].trim() !== '') {
+ const newTodos = [...todos];
+ newTodos[index].lists.push(listInputs[index]);
+ setTodos(newTodos);
+ setListInputs({ ...listInputs, [index]: '' });
+ }
+ };
+
+ const handleListInputChange = (index, value) => {
+ setListInputs({ ...listInputs, [index]: value });
+ };
+
+ return (
+ <>
+
+
My Todo List
+
+ setHeadingInput(e.target.value)}
+ />
+
+
+
+
+ {todos.map((todo, index) => (
+
+
+
{todo.heading}
+
+
+
+ {todo.lists.map((list, listIndex) => (
+ -
+
{list}
+
+ ))}
+
+
+ handleListInputChange(index, e.target.value)}
+ />
+
+
+
+ ))}
+
+ >
+ );
};
-export default TodoList;
+export default TodoList;
\ No newline at end of file