-
Notifications
You must be signed in to change notification settings - Fork 10
[4주차] 신수진 미션 제출합니다. #18
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
base: master
Are you sure you want to change the base?
[4주차] 신수진 미션 제출합니다. #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시험과 과제 모두 수고하셨습니다 !! 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
레이아웃 관련 로직은 따로 컴포넌트로 분리해서 import 하여 작성하는 게 유지보수나 확장성 면에서 더 좋을 것 같습니다!
그리고 스플래시 화면은 화면을 새로고침할 때마다 뜨는 것 같아서, 혹시 앱을 처음 실행할 때만 뜨는 화면이 아닌지 궁금합니당
코드 로직을 보았을 때 채팅방이나 채팅 리스트에서도 새로고침을 했을 때 화면이 뜨는 것 같아서요!
import HomeIcon from "../assets/icons/TabBar/Home.svg?react"; | ||
import PhoneIcon from "../assets/icons/TabBar/Phone.svg?react"; | ||
import SpeechBubbleIcon from "../assets/icons/TabBar/SpeechBubble.svg?react"; | ||
import ServiceIcon from "../assets/icons/TabBar/Service.svg?react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추후 파일과 코드가 많아지면, 절대 경로를 사용하는 방식을 적용해보는 것도 좋을 것 같습니다 :)
그동안 절대 경로로 코드를 작성하면서 느낀 바로는, 상대 경로에서 발생할 수 있는 경로 오류나 관리의 어려움을 방지할 수 있었고, 코드의 가독성도 높아져서 유지보수와 확장성 측면에서 도움이 될 수 있었습니다 !!
"roomId": 1, | ||
"allChats": [ | ||
{ | ||
"date": "2025년 3월 26일 수요일", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
실제 백엔드 API를 호출할 때는 ISO 날짜 형식을 받아와 프론트에서 가공하는 함수를 작성하는 경우가 많으니, 목데이터에서도 해당 형식을 그대로 사용해서 함수를 작성해보아도 좋을 거 같습니다!
const TabBarWrapper = styled.div` | ||
position: absolute;; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
width: 100%; | ||
display: flex; | ||
justify-content: space-around; | ||
align-items: center; | ||
height: 60px; | ||
border-top: 1px solid #ddd; | ||
background-color: white; | ||
`; | ||
|
||
const IconWrapper = styled.div<{ $active: boolean }>` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
color: ${({ $active }) => ($active ? "black" : "gray")}; | ||
font-size: 12px; | ||
transition: color 0.3s ease; | ||
|
||
svg { | ||
width: 24px; | ||
height: 24px; | ||
fill: #ffffff // 아이콘 색 | ||
margin-bottom: 4px; | ||
} | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드가 짧긴 하지만, 스타일 파일로 별도 분리해도 좋을 거 같아요!
isFixed: boolean; | ||
} | ||
|
||
const ChatRoomList: React.FC = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
최근에는 React.FC를 사용하지 않는 것이 더 권장되는 방식으로 여겨지고 있는데, 관련 링크 첨부해드립니다!
`; | ||
|
||
export const SplashContainer = styled.div` | ||
animation: ${fadeIn} 1.5s ease-in-out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
애니메이션이 있어서 자연스럽게 화면 전환이 이루어지고 더욱 보기 좋은 거 같아용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로컬에서 실행했을 때 콘솔에 해당 오류가 나는데, iscurrentuser를 전달해줄 때 앞에 $를 붙이면 DOM으로 전달되지 않아 경고문을 해결할 수 있습니다 ! 관련 블로그 남겨두겠습니당
BLOG

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
친구 리스트나 채팅방에서 유저를 클릭했을 때 상대방 시점으로 채팅 리스트나 홈 화면, 채팅방 전환이 바로 적용되는 점이 인상 깊었습니다!
현재 로컬 스토리지에 아이디를 저장하여 불러오는 방식이 잘 작동하고 있지만, 아이디와 같은 민감한 정보를 로컬스토리지에 저장하는 것은 보안상 위험이 있을 수 있으니, 전역 상태 관리를 적용하면 더 안전하고 효율적으로 상태를 관리할 수 있을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스타일은 별도 파일로 분리하고, 함수 이름은 friendList처럼 파일명과 일치하는 네이밍을 주로 사용하는 것을 권장드려요 !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맨 마지막 친구까지 스크롤했을 때 바로 하단에 TabBar가 붙는 느낌이 들어서, 하단에 여백을 추가해주는 것도 좋을 것 같습니다.
allChats: AllChats[]; | ||
} | ||
|
||
const ChatRoomDetail: React.FC = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일명과 일치시키는 것이 일관성 유지에 좋을 것 같습니다!
<input | ||
type="text" | ||
value={newMessage} | ||
onChange={(e) => setNewMessage(e.target.value)} | ||
placeholder="메시지를 입력하세요" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
채팅방에서는 장문의 텍스트를 입력하는 경우가 많기 때문에, textarea를 사용하여 작성한 글을 바로 보여주는 방식이 사용자에게 더 직관적이고 편리할 것 같습니다.
또한, enter 키를 눌렀을 때 메시지가 전송되고, shift + enter를 눌렀을 때 줄바꿈이 되도록 설정하면, 사용자가 자연스럽게 채팅을 작성할 수 있을 것 같습니당
추가로,, textarea의 높이는 작성하는 텍스트의 양에 맞춰 자동으로 조정되면 사용자 경험이 더 향상될 것 같습니다 !!
vercel 설정 파일 추가해서 새로고침 되도록 해야 할 것 같아용 |
} | ||
}; | ||
|
||
const handleBackClick = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뒤로가기는 navigate(-1)로 작성해도 좋을 것 같아용
gap: 0.75rem; | ||
`; | ||
|
||
export const BackIcon = styled.img` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursor:pointer를 추가해도 좋을 것 같습니당
font-family: Pretendard; | ||
font-size: 0.9375rem; | ||
font-weight: 400; | ||
line-height: 140%; | ||
letter-spacing: -0.00094rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 스타일들은 font 관련 theme를 따로 설정해서, 매번 코드마다 직접 작성하지 않고 편하게 사용할 수 있습니다 !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스타일은 별도 파일로 분리하고, 함수 이름은 friendList처럼 파일명과 일치하는 네이밍을 주로 사용하는 것을 권장드려요 !!
https://react-messenger-21th-sujin.vercel.app/
일단 이전 주차에서의 파일 구조 리팩토링과, 아이콘들 svg파일로 다시 다운받으면서 svg?react 형식으로 수정하여 활용하였으며, 나머지 구현이 안된 부분들을 마저 구현하고자 하였습니다.
시험이 끝난지 얼마 안돼서, 시간이 부족한 이슈로 급하게 과제를 수행하느라 아직 디자이너분이 제시한 화면과 다른 점이 조금 있습니다. 월요일 프론트엔드 세션 전까지 계속 코드 수정하고자합니다.
1. React Router의 동적 라우팅(Dynamic Routing)이란 무엇이며, 언제 사용하나요?
동적 라우팅은 애플리케이션의 라우트를 정적으로 설정하는 대신, 애플리케이션 실행 중에 라우트를 동적으로 변경하거나 추가하는 방식. 일반적으로 React Router에서는
Route
컴포넌트를 사용해 라우팅을 설정합니다. 동적 라우팅을 사용하면 URL 경로에 따라 컴포넌트나 페이지를 동적으로 렌더링할 수 있음.사용 예시:
위와 같은 라우팅 설정은
/profile/1
,/profile/2
와 같은 동적 URL에 따라Profile
컴포넌트를 다르게 렌더링할 수 있다.2. 네트워크 속도가 느린 환경에서 사용자 경험을 개선하기 위해 사용할 수 있는 UI/UX 디자인 전략과 기술적 최적화 방법은 무엇인가요?
UI/UX 디자인 전략:
기술적 최적화 방법:
srcset
을 사용하거나, 이미지 압축 기술을 활용함.GraphQL
이나REST API
에서 필요 최소한의 데이터만 요청하도록 함.3. React에서 useState와 useReducer를 활용한 지역 상태 관리와 Context API 및 전역 상태 관리 라이브러리의 차이점을 설명하세요.
useState
: 컴포넌트 내에서 단일 상태를 관리할 때 사용합니다. 간단한 상태 변경에 적합하며, 값이 바뀔 때마다 컴포넌트를 리렌더링함.useReducer
: 상태가 복잡하거나 여러 액션에 의해 상태가 변경될 때 유용합니다.useState
보다 더 복잡한 로직을 필요로 할 때 사용하며, 상태 관리가 여러 조건에 따라 이루어지는 경우에 적합함.Context API
: 여러 컴포넌트에 걸쳐 상태를 공유할 때 유용합니다.Context
를 사용하면 prop drilling(중간 컴포넌트를 통해 데이터를 전달)을 피할 수 있으며, 앱 내에서 전역 상태를 관리할 수 있습니다. 그러나Context API
는 너무 자주 변경되는 상태를 다루기에는 성능 이슈가 있을 수 있음.전역 상태 관리 라이브러리 (예: Redux, Zustand, Recoil 등): 앱의 전역 상태를 보다 효율적으로 관리하기 위해 사용됩니다. 여러 컴포넌트에서 상태를 공유하고 업데이트해야 할 때 강력한 도구가 됩니다. 일반적으로
Redux
같은 라이브러리는 복잡한 상태 관리 로직을 처리할 수 있도록 돕습니다. 또한,Redux
는 상태를 관리하는 중앙 스토어를 제공하고,Actions
를 통해 상태를 변경함.