diff --git a/src/Counter/index.js b/src/Counter/index.js index c6686e6..8a8faa8 100644 --- a/src/Counter/index.js +++ b/src/Counter/index.js @@ -1,15 +1,23 @@ -import React from "react"; +import React, { useState } from "react"; import "./index.css"; // Counter의 시작은 0부터 시작합니다. const Counter = () => { + const [num, setNum] = useState(0); + + const countChange = (e) => { + const countN = num + e; + + if(countN >= -10 && countN <= 10){ + setNum(countN); + } +}; return (
- -

{/** 여기에 카운트가 나타납니다. 주석 삭제 후 작성해주세요 */}

- + +

{num}

+
); }; - export default Counter; diff --git a/src/Input/index.js b/src/Input/index.js index 5802db4..930a9af 100644 --- a/src/Input/index.js +++ b/src/Input/index.js @@ -1,7 +1,11 @@ import React from "react"; -const Input = () => { - return ; +const Input = ({onChange, value}) => { + return ( + ); }; export default Input; diff --git a/src/ShowBox/index.js b/src/ShowBox/index.js index 65d55d1..fb22478 100644 --- a/src/ShowBox/index.js +++ b/src/ShowBox/index.js @@ -1,16 +1,24 @@ -import React from "react"; +import React, { useState } from "react"; import "./index.css"; import Input from "../Input"; -const ShowBox = () => { +function ShowBox() { + + const [text, setText] = useState(""); + + const InputChange = (e) => { + const inputText = e.target.value; + + setText(inputText); +}; + return (
- +

- {/* 여기 안에 Input에서 입력한 값이 나와야 해요. 주석은 지워주세요 */} + {text ? text : "값을 입력해주세요"}

); }; - export default ShowBox;