diff --git a/src/App.js b/src/App.js index b428f9a..4e3f162 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,8 @@ import React, { useState } from "react"; +import styled from 'styled-components'; function App() { - const [tasks, setTasks] = useState([]); + const [tasks, setTasks] = useState(["자기","놀기","먹기"]); const [input, setInput] = useState(""); const handleAddTask = () => { @@ -15,18 +16,42 @@ function App() { setInput(event.target.value); }; + const handleDelete = (index) => { + // 놀기 index=2 + const newTasks = tasks.filter((task,i) => i != index); + setTasks(newTasks); + }; + return (