From b38fbd5144937f1b5b5d67133676ecc9af3e5d26 Mon Sep 17 00:00:00 2001 From: kyoul10121 Date: Mon, 14 Oct 2024 15:43:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=83=81=EB=8B=A8,=20=20=ED=95=98?= =?UTF-8?q?=EB=8B=A8=20=EB=AF=B8=EC=85=98=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 78 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index aa4d827..bc8c345 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -10,61 +10,95 @@ const initialTodos = [ ]; export default function App() { + const [isName, setIsName] = useState() + const [isEditing, setIsEditing] = useState(false); const [todos, setTodos] = useState( initialTodos ); function handleAddTodo(title) { - todos.push({ - id: nextId++, - title: title, - done: false - }); + setTodos([ + + ...todos, + { + id: nextId++, + title: title, + done: false, + } + ]) } function handleChangeTodo(nextTodo) { - const todo = todos.find(t => - t.id === nextTodo.id + setTodos( + todos.map((t) => { + if (t.id === nextTodo.id) { + return nextTodo; + } else { + return t; + } + }), ); - todo.title = nextTodo.title; - todo.done = nextTodo.done; } function handleDeleteTodo(todoId) { - const index = todos.findIndex(t => - t.id === todoId - ); - todos.splice(index, 1); + setTodos(todos.filter((t) => t.id != todoId)); } + const [info, setInfo] = useState({ + name: "", + major: "", + email: "", + github: "", + }); + const onChange = (e) => { + setInfo({...info, [e.target.name]:e.target.value}); + }; + const [isEdit, setIsEdit] = useState(false); + const handleClickBtn = () => { + setIsEdit(!isEdit); + }; return ( <> + {isEdit ? ( +
-

안녕하세요, 프론트엔드 개발자 고윤정입니다.

+

안녕하세요, 프론트엔드 개발자입니다.

-
+ ):( + <> +

안녕하세요, 프론트엔드 개발자 {info.name}입니다.

+
+ + + +
+
+ +
{" "} + + )}

오늘의 할일