From 5820f7d6781221c94882b4341c7b8b448779fd73 Mon Sep 17 00:00:00 2001 From: LHK <30331140+freerer2@users.noreply.github.com.> Date: Fri, 21 Feb 2025 18:03:52 +0900 Subject: [PATCH] =?UTF-8?q?=EC=95=84=EB=94=B0=20=EB=8C=80=EA=B0=80?= =?UTF-8?q?=EB=A6=AC=20=EA=B9=A8=EC=A7=80=EB=84=A4=20=EC=98=88=EC=8B=9C=20?= =?UTF-8?q?=EB=A7=8C=EB=93=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/codeStyles/codeStyleConfig.xml | 5 +++++ frontend/app/page.tsx | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index ca1e4c0..db4d2c1 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -5,15 +5,20 @@ import { main } from "@/wailsjs/go/models"; import React, {useState} from "react"; export default function Home() { - const [person, setPerson] = useState(new main.Person()); + const [person, setPerson] = useState(new main.Person({name: "", age: 0})); const [result, setResult] = useState('Please enter your name below ๐Ÿ‘‡'); const handleInputChange = (e: React.ChangeEvent, field: string) => { - setPerson(prevPerson => ({ - ...prevPerson, - [field]: field === 'age' ? parseInt(e.target.value) : e.target.value, - convertValues: prevPerson.convertValues // ๊ธฐ์กด convertValues ์†์„ฑ ์œ ์ง€ - })); + setPerson(prevPerson => { + const updatedPerson = { + ...prevPerson, + [field]: field === 'age' ? parseInt(e.target.value) : e.target.value + }; + return { + ...updatedPerson, + convertValues: prevPerson.convertValues.bind(updatedPerson) + }; + }); }; return <>