diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index b110e44..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "terminal.integrated.fontSize": 60 -} \ No newline at end of file diff --git a/src/App.js b/src/App.js index af6b858..876a92e 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,14 @@ +// importing useState from React import { useState } from 'react' +// importing Header, list and AddTodo components import Header from "./components/Header"; import List from "./components/List" import AddTodo from "./components/AddTodo" +// creating a function component function App() { + // destructing varibles to set and change the state which has an array of todo item objects const [todos, setTodos] = useState([ { id: 1, @@ -20,16 +24,20 @@ function App() { }, ]); + // creating a new todo handler function to change the current state using setTodos const addTodo = (todo) => { const id = Math.ceil(Math.random()*100000) const newTodo = {id, ...todo} setTodos([...todos, newTodo]) } - +// the App component returns a div element with a Header, AddTodo and List components return (