diff --git a/src/App.tsx b/src/App.tsx index 7c16a26..87342c6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,11 +3,35 @@ import type { Task } from "./assets/types/task"; function App() { const [tasks, setTasks] = useState([]); + const [inputValue, setInputValue] = useState(''); + + const addTask = () => { + if (inputValue.trim() === '') return; + + const newTask: Task = { + id: Date.now(), + title: inputValue, + completed: false, + createdAt: new Date().toISOString() + }; + + setTasks([...tasks, newTask]); + + setInputValue(''); + }; return (

SmartX Task Manager

+
+ setInputValue(e.target.value)} + /> + +
{tasks.length === 0 ? (

No task found. Lets add!