diff --git a/src/components/Button.jsx b/src/components/Button.jsx index 9fa8039..f68f712 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; +export default Button; \ No newline at end of file diff --git a/src/components/Counter.jsx b/src/components/Counter.jsx index 31ec31c..5bd2d2f 100644 --- a/src/components/Counter.jsx +++ b/src/components/Counter.jsx @@ -3,23 +3,34 @@ import { StyledButton, CounterWrapper, ButtonWrapper } from "./styles"; function Counter() { const [isSent, setIsSent] = useState(false); + const [count, setCount] = useState(0); + + function handleCount(e) { + e.stopPropagation(); + e.preventDefault(); + setCount((count) => count+1); + } + + function handleSend(e) { + e.stopPropagation(); + setIsSent(true) + } if (isSent) { return
전송되었습니다.
; } else { - const [count, setCount] = useState(0); return ( {count} - setCount(count + 1)}> + 더하기 - setIsSent(true)}>Send + Send ); } } -export default Counter; +export default Counter; \ No newline at end of file diff --git a/src/components/Input.jsx b/src/components/Input.jsx index efe3c47..7acdaf5 100644 --- a/src/components/Input.jsx +++ b/src/components/Input.jsx @@ -1,12 +1,17 @@ import { StyledInput } from "./styles"; +function handleInput(e) { + e.preventDefault(); + e.stopPropagation(); +} + function Input() { return ( <>

입력

- + ); } -export default Input; +export default Input; \ No newline at end of file diff --git a/src/components/Wrapper.jsx b/src/components/Wrapper.jsx index bda9444..12d64c5 100644 --- a/src/components/Wrapper.jsx +++ b/src/components/Wrapper.jsx @@ -4,11 +4,11 @@ function Wrapper({ children }) { alert("배경 클릭"); }; return ( - +

배경을 클릭할 수 있어요

{children}
); } -export default Wrapper; +export default Wrapper; \ No newline at end of file