소캣 예민보스

LEE JI YOUNG·2022년 3월 3일
0

에러핸들링

목록 보기
18/24
 useEffect(() => {
    socket.on(
      'message',
      ({ user_id, contents, createdAt }) => {
        console.log('소캣온 잘 받고 있나요 ? ',  user_id, contents, createdAt)
        dispatch({ 
          type: 'ADD_MESSAGE', 
          payload: {
              contents: contents,
              profileImage: socketParticipant[user_id]['profileImage'] || '',
              name: socketParticipant[user_id]['name'] || '??',
              createdAt: timeSetting(createdAt) || createdAt
          }
      });
      },
      (error) => {
        console.log('why error?',error);
      }
    );
  }, []);

소캣 예민하다. 꼭 || null 넣어조라..

profile
프론트엔드 개발자

0개의 댓글