Skip to content

Commit

Permalink
feat: 오늘날짜 기준 메시지 모두 반환해주는 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeriinnn committed Jun 14, 2024
1 parent e0d3ebd commit 033f1c3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/component/live/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,7 @@ const ChatScreen = () => {
console.log("받은 메시지: ", message.body);
const body = JSON.parse(message.body);

// ID를 사용하여 중복 확인
const existingMessage = messages.find(msg => msg.id === body.id);
if (!existingMessage) {
setMessages(prevMessages => {
const updatedMessages = [...prevMessages, body];
console.log("업데이트된 messages 상태: ", updatedMessages);
return updatedMessages;
});
}
setMessages(prevMessages => [...prevMessages, body]);
};

const sendMessage = () => {
Expand Down

0 comments on commit 033f1c3

Please sign in to comment.