From 634ee8a10175c67f32296f402ed1020af615ad37 Mon Sep 17 00:00:00 2001 From: Yoonjeong Ko Date: Wed, 11 Sep 2024 23:29:19 +0900 Subject: [PATCH 1/3] =?UTF-8?q?2=EC=A3=BC=EC=B0=A8=20=ED=80=B4=EC=A6=88=20?= =?UTF-8?q?=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 2 +- src/components/Button.jsx | 7 ++++++- src/components/Counter.jsx | 12 +++++++++--- src/components/Input.jsx | 2 +- src/components/Wrapper.jsx | 3 ++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 8e619ec..691fd0f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2,7 +2,7 @@ import Button from "./components/Button"; import Counter from "./components/Counter"; import Input from "./components/Input"; import Wrapper from "./components/Wrapper"; - +// 버그 5개 function App() { return ( diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 9fa8039..70c4520 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -1,7 +1,12 @@ import { StyledButton } from "./styles"; function Button() { - return 제출; + function handleButton(e){ + e.stopPropagation(); + alert("제출 버튼 클릭"); + } + + return 제출; } export default Button; diff --git a/src/components/Counter.jsx b/src/components/Counter.jsx index 31ec31c..8b6f3d5 100644 --- a/src/components/Counter.jsx +++ b/src/components/Counter.jsx @@ -3,19 +3,25 @@ import { StyledButton, CounterWrapper, ButtonWrapper } from "./styles"; function Counter() { const [isSent, setIsSent] = useState(false); + const [count, setCount] = useState(0); if (isSent) { return
전송되었습니다.
; } else { - const [count, setCount] = useState(0); return ( {count} - setCount(count + 1)}> + { + e.stopPropagation(); + setCount(count + 1); + }}> 더하기 - setIsSent(true)}>Send + { + e.preventDefault(); + setIsSent(true); + }}>Send ); diff --git a/src/components/Input.jsx b/src/components/Input.jsx index efe3c47..9ed89ee 100644 --- a/src/components/Input.jsx +++ b/src/components/Input.jsx @@ -1,5 +1,5 @@ import { StyledInput } from "./styles"; - +// 전파 방지 function Input() { return ( <> diff --git a/src/components/Wrapper.jsx b/src/components/Wrapper.jsx index bda9444..359deb8 100644 --- a/src/components/Wrapper.jsx +++ b/src/components/Wrapper.jsx @@ -3,8 +3,9 @@ function Wrapper({ children }) { const clickFunc = () => { alert("배경 클릭"); }; + return ( - +

배경을 클릭할 수 있어요

{children}
From 52c5ff15f85e2936cc8e2e03d387dcc7674e4cd2 Mon Sep 17 00:00:00 2001 From: Yoonjeong Ko Date: Wed, 11 Sep 2024 23:35:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20:=20=EC=83=88=EB=A1=9C=20=EA=B3=A0?= =?UTF-8?q?=EC=B9=A8=20=EB=B0=A9=EC=A7=80=EB=A1=9C=20=EC=B9=B4=EC=9A=B4?= =?UTF-8?q?=ED=84=B0=20=EC=A6=9D=EA=B0=80=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84,=20send=20=EB=B2=84=ED=8A=BC=20=EC=A0=84=ED=8C=8C=20?= =?UTF-8?q?=EB=B0=A9=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Counter.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Counter.jsx b/src/components/Counter.jsx index 8b6f3d5..d657843 100644 --- a/src/components/Counter.jsx +++ b/src/components/Counter.jsx @@ -14,11 +14,13 @@ function Counter() { { e.stopPropagation(); + e.preventDefault(); setCount(count + 1); }}> 더하기 { + e.stopPropagation(); e.preventDefault(); setIsSent(true); }}>Send From d2ca9c457a72eabf33dc49c0e0b5d863b89503af Mon Sep 17 00:00:00 2001 From: Yoonjeong Ko Date: Wed, 11 Sep 2024 23:36:26 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20:=20=EC=9E=85=EB=A0=A5=EC=B0=BD=20?= =?UTF-8?q?=EC=A0=84=ED=8C=8C=EB=B0=A9=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Input.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Input.jsx b/src/components/Input.jsx index 9ed89ee..0d5fffd 100644 --- a/src/components/Input.jsx +++ b/src/components/Input.jsx @@ -4,7 +4,7 @@ function Input() { return ( <>

입력

- + {e.stopPropagation();}}/> ); }