From cd1cb70bd78f2b2202eb814df0ae61c26e9918c3 Mon Sep 17 00:00:00 2001 From: Hyun731 Date: Thu, 31 Jul 2025 14:56:27 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=EC=9D=B8=ED=92=8B=ED=8F=AC=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4,=EA=B8=B0=EB=A1=9D=EC=B6=94=EA=B0=80,=EC=9D=B8?= =?UTF-8?q?=ED=92=8B=EC=A6=89=EA=B0=81=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 15 ++++----------- src/components/Focus.jsx | 22 ++++++++++++++++++++++ src/components/Input.jsx | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 src/components/Focus.jsx create mode 100644 src/components/Input.jsx diff --git a/src/App.jsx b/src/App.jsx index 5d62758..7562728 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,17 +1,10 @@ -import { useState } from "react"; -import reactLogo from "./assets/react.svg"; -import viteLogo from "/vite.svg"; import "./App.css"; +import Input from "./components/Input" function App() { - const [count, setCount] = useState(0); - const name = "류승찬"; - - return ( - <> - 화이팅 - + return( + ); } -export default App; +export default App; \ No newline at end of file diff --git a/src/components/Focus.jsx b/src/components/Focus.jsx new file mode 100644 index 0000000..097edbf --- /dev/null +++ b/src/components/Focus.jsx @@ -0,0 +1,22 @@ +import { useState,useEffect } from 'react'; + +function Log({ text }) { + const [texts, setTexts] = useState([]); + + useEffect(() => { + if (texts.length > 0) { + console.log("추가됨"); + } + }, [texts]) + const handleAdd = () => { + setTexts([...texts, text]); + }; + return ( +
+ +

목록: {texts.join(', ')}

+
+ ); +} + +export default Log; diff --git a/src/components/Input.jsx b/src/components/Input.jsx new file mode 100644 index 0000000..d68f765 --- /dev/null +++ b/src/components/Input.jsx @@ -0,0 +1,24 @@ +import { useState,useRef } from "react"; +import Log from "./Log" + + + +function Input() { + const [inp, setInp] = useState(''); + + const inpRef = useRef(null); + + const focusInp = () => { + inpRef.current.focus() + } + return ( +
+ + { setInp(e.target.value) }}> +

입력한 내용 : {inp}

+ +
+ ); +} + +export default Input; \ No newline at end of file From 1d17877eece2f2ff213c3f9907c275cd485396dd Mon Sep 17 00:00:00 2001 From: Hyun731 Date: Thu, 31 Jul 2025 15:54:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=ED=8C=8C=EC=9D=BC=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/{Focus.jsx => Log.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/components/{Focus.jsx => Log.jsx} (100%) diff --git a/src/components/Focus.jsx b/src/components/Log.jsx similarity index 100% rename from src/components/Focus.jsx rename to src/components/Log.jsx