# Todo list application with react hooks

import "./styles.css";

import { useState } from "react";

  
export default function App() { const \[todoList, setTodoList\] = useState(\[\]); const \[input, setInput\] = useState("");  
const addItem = (e) =&gt; { if (input.length) { const item = { id: Math.random(), todo: input, isCompleted: false }; setTodoList(\[...todoList, item\]); setInput(""); } };  
const removeItem = (id) =&gt; { const removeArr = \[...todoList\].filter((todo) =&gt; [todo.id](http://todo.id) !== id); setTodoList(removeArr); }; return ( &lt;div className="App"&gt; &lt;input type="text" value={input} onChange={(e) =&gt; setInput([e.target](http://e.target).value)} /&gt; &lt;button onClick={addItem}&gt;Save&lt;/button&gt; &lt;ul&gt; {[todoList.map](http://todoList.map)(({ id, todo, isCompleted }) =&gt; ( &lt;li className={isCompleted ? "todo strike" : "todo"} onClick={() =&gt; removeItem(id)} &gt; {todo} &lt;/li&gt; ))} &lt;/ul&gt; &lt;/div&gt; );}
