import React, { useState, useEffect } from 'react'; import { Form, Button, Row } from 'react-bootstrap'; function Chat(props) { const [inner, setInner] = useState(['']) const [chat, setChat] = useState([inner]) //object로 key는 보낸사람 value는 메세지 function handleChange(e) { e.preventDefault() setInner(e.target.value) console.log(e.target.value) } function sendMsgCH(e) { e.preventDefault() props.setSingleChat(inner) props.sendMsg(e) setInner('') } useEffect(() => { setChat([...chat, props.singleChat]) }, [props.singleChat]) return (