Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4주차] 이현영 미션 제출합니다. #19

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

hamo-o
Copy link

@hamo-o hamo-o commented Nov 4, 2022

안녕하세요 16기 이현영입니다!

저번 과제에 recoil이 아니라 context를 사용했는데,
리렌더링 부분 등 확실히 recoil의 편의성에 대해 알 수 있었습니다. 사용하기 더 쉽기도 했구요!
또 저번 과제를 진행하면서 user 전환을 할 때 꼭 다음 입력을 해줘야 전환이 되었는데, 클릭이벤트의 위치를 바꾸며 해결했습니다!!
코드 중복도 많고 단톡방으로 확장하려면 또다시 뜯어고쳐야겠다는 생각이 들었지만,,
기능들을 구현하면서 많이 배웠던 과제였습니다!

🔗 배포링크

핵심 기능은 구현했지만 스터디 전까지 고치고 싶은 부분입니다!

  • 채팅방에 들어갔을 때만 깨지는 사진 고치기
  • key값을 user id로 unique하게 지정해주었음에도 콘솔에 오류 뜨는 이유..
  • 채팅 시간 추가
  • 채팅 시간이 분단위로 넘어갈 때만 프로필 보여주기
  • 쓰지 않은 코드, 겹치는 코드 정리하기

Key Questions

Routing
Router : 데이터의 경로를 실시간으로 지정해주는 것
Routing : 경로를 정해주는 행위 + 과정들
Page Routing : 요청에 명시되어있는 경로에 따라 어떤 페이지를 돌려줄지 결정, 반환
새로고침 없이 페이지를 전환한다

SPA
SPA : Single Page Application
하나의 페이지를 사용하는 어플리케이션.
서버로부터 새로운 페이지를 가져오는 것이 아닌, 하나의 페이지에서 내용을 동적으로 변경한다
CSR : Client Side Rendering 방식으로 랜더링한다

상태관리
상태관리 : 변화하는 데이터들을 관리하는 것.
상태의 초기 값 저장, 상태의 값 읽기, 상태 업데이트 등의 행위.
상태관리를 위한 도구들: Redux, Context API, Recoil

@jhj2713
Copy link
Member

jhj2713 commented Nov 5, 2022

안녕하세요, 프론트 파트장 주효정입니다🙌

프로필 사진 강쥐들이 너무 귀엽네요😄 나름 재밌게(?) 과제하셨을 거라고 믿습니다ㅎㅎ

이미 고치셨을 수도 있는데, 고치고 싶은 부분에 대해 말씀드리자면 우선 이미지 깨지는 것 같은 경우에는 현재 ChatBoxItem에서 user_img를 불러오고 있는게 문제인 것 같습니다. ChatBoxList에서 chatState의 값을 ChatBoxItem에 props로 내려주고 있는데, chatState에는 user_img가 없네요.
그리고 key값이 unique하지 않는다는 오류는 FriendsList에서 나는 오류를 말씀하신다면 아마 map으로 뿌려주는 최상단 컴포넌트에 key를 부여하지 않고 하위 컴포넌트 FriendItem에 key를 부여해서 발생하는 문제일 것 같아요!

이번주도 수고많으셨고 스터디 시간에 뵐게요~!🥳

Copy link
Member

@YooSeonHo YooSeonHo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 현영님~ 채팅방을 너무 예쁘게 잘 만드셔서 코드도 유심히 훔쳐봤습니다 흐흐
저랑 비슷하지만 다르게 짠 부분들에서 많이 배워갑니다!!!!
너무 고생 많으셨고 스터디때 봬용~!

rightChild: string;
}

const Header = ({ leftChild, rightChild }: Props) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftChild , rightChild가 생소해서 조금 찾아보니까 컴포넌트 재사용률을 더 높일 수 있는 방법이었네요... 덕분에 알아갑니다 하핫

id: number;
}

const InputBox = ({ id }: Props) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

props interface를 위에서 미리 만들어주는 거 좋은 거 같아욧~!

<UserItemWrapper>
<UserItemWrapper
onClick={() => {
navigate(`/chatRoom/${id}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와.. 전 link로 그냥 컴포넌트를 덮어버렸는데 네비게이트가 더 좋은 거 같아요 ㅠ.ㅠ 굿굿..

import { useRecoilValue } from 'recoil';
import styled from 'styled-components';

import { userState, chatState } from '../../recoil/recoil';
import ChatBoxItem from './ChatBoxItem';

const ChatBoxList = ({ id }: { id: number }) => {
const ChatBoxList = () => {
const { id } = useParams();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 useParams쓰셨군요..! 저도 처음에 파람스로 쓰려고 하다가
recoil로 받아오는 게 더 편해서 바꿨었는데 현영님은 두개 중 어떤게 더 편하셨나용

Copy link
Member

@kongnayeon kongnayeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 현영 님! 이번 주 코드 리뷰 파트너입니다 ㅎ.ㅎ

코드가 엄청 깔끔하고 저랑 다르게 작성한 부분들도 많아서 많이 배울 수 있었습니다!
코드를 되게 꼼꼼히 짜시는 것 같다고 느껴졌어욥!!
그리고 textarea 태그를 사용하면 줄바꿈이 가능한 걸로 아는데 저도 사용하려다가 시간 부족으로 input 태그 사용으로 마무리 했었거든요 ㅜㅡㅜ...
이따 개별 토론 세션 때 이 부분에 대해 같이 이야기 나눠 보면 좋을 것 같아요!!

과제하느라 수고 많으셨고 이따 스터디 시간에 봬요!! 😸

const reset = useCallback((): void => {
setText(init);
}, [init]);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우와 useCallback되게 잘 활용하시네용... 저는 사용하지 않고 useInput 훅을 작성했었는데 배워갑니당...!!

return (
user.user_name !== users[0].user_name &&
user.user_name.toLocaleLowerCase().includes(text.toLocaleLowerCase())
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 toLowerCase()를 사용했는데 toLocaleLowerCase() 를 사용하면 영어가 아닌 다른 언어도 소문자로 바꿔 주는군용...! 저도 다음부터는 toLocaleLowerCase() 사용해야겠어요 🤩

align-items: center;

gap: 2rem;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우와 저는 항상 margin-bottom 사용했었는데!! 배워갑니당... 👀


input:focus {
outline: none;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우와 이렇게 한번에 초깃값을 없애는 방법 좋네요... 🤩


font-size: 0.9rem;
font-weight: 500;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
word-break: break-all;

image
image

채림님한테 배운 건데... 이렇게 하면 영어로 길게 쳤을 때도 말풍선이 깨지지 않아용!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants