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 <>