sdy

add empty array in useEffect

...@@ -156,7 +156,7 @@ export default ({ ...@@ -156,7 +156,7 @@ export default ({
156 }) => { 156 }) => {
157 const { pathname } = location; 157 const { pathname } = location;
158 const roomName = pathname.slice(1, pathname.length); 158 const roomName = pathname.slice(1, pathname.length);
159 - useEffect(() => subscribeToNewMessage()); 159 + useEffect(() => subscribeToNewMessage(), []);
160 160
161 return ( 161 return (
162 <Wrapper> 162 <Wrapper>
...@@ -176,20 +176,18 @@ export default ({ ...@@ -176,20 +176,18 @@ export default ({
176 </ChatMenuContainer> 176 </ChatMenuContainer>
177 <ChatScreenContainer> 177 <ChatScreenContainer>
178 <ChatScreenHeader> 178 <ChatScreenHeader>
179 - <Title>Selected Menu Title</Title> 179 + <Title>{roomName}</Title>
180 </ChatScreenHeader> 180 </ChatScreenHeader>
181 <ChatScreenBox> 181 <ChatScreenBox>
182 - <ul> 182 + {messageArray &&
183 - {messageArray && 183 + messageArray.seeAllMessage.map((e) => (
184 - messageArray.seeAllMessage.map((e) => ( 184 + <Message
185 - <Message 185 + text={e.text}
186 - text={e.text} 186 + time={e.createdAt}
187 - time={e.createdAt} 187 + key={e.id}
188 - key={e.id} 188 + avatar={e.sender.avatarUrl}
189 - avatar={e.sender.avatarUrl} 189 + />
190 - /> 190 + ))}
191 - ))}
192 - </ul>
193 <InputContainer className="InputContainer"> 191 <InputContainer className="InputContainer">
194 <form onSubmit={onSubmit}> 192 <form onSubmit={onSubmit}>
195 <Input 193 <Input
......