Week6/sori m1#64
Open
soyun0318 wants to merge 5 commits into
Open
Conversation
yewon20804
reviewed
May 12, 2026
Collaborator
yewon20804
left a comment
There was a problem hiding this comment.
6주차 첫번째 미션 수고하셨습니다! useQuery를 활용해서 LP 목록/상세 화면을 구현해주셨는데요, 스켈레톤 UI와 에러 재시도 컴포넌트까지 꼼꼼하게 챙겨주신 게 인상적이에요 !
PR 올리실 때 화면 녹화도 함께 첨부해주시면 리뷰할 때 더 도움이 될 것 같습니다 ㅎㅎ
아래 코멘트 확인해주세요 🙂
1. LpDetailPage.tsx — Rules of Hooks 위반
// 현재 (week4/UMC-FE/src/pages/LpDetailPage.tsx)
if (!accessToken) {
navigate("/login", ...);
return null;
}
// ❌ 조건문 이후 Hook 호출 → Rules of Hooks 위반
const {data, isLoading, isError} = useQuery({...});
// 수정
// useQuery를 조건문보다 먼저 선언하고, enabled 옵션으로 실행 여부를 제어하세요
const {data, isLoading, isError} = useQuery({
queryKey: ['lp', lpId],
queryFn: () => getLpDetail(Number(lpId)),
enabled: !!lpId && !!accessToken, // accessToken이 없으면 쿼리 실행 안 함
});
if (!accessToken) {
navigate("/login", { state: { from: location } });
return null;
}
조건문(if (!accessToken)) 이후에 useQuery를 호출하고 있는데, React는 Hook을 조건문 안이나 조건문 이후에 사용할 수 없어요. 매 렌더링마다 Hook 호출 순서가 달라지면 예측 불가능한 버그가 생길 수 있습니다.
2. myPage.tsx — Tailwind 클래스 오타
// 현재 (week4/UMC-FE/src/pages/myPage.tsx)
<button className="cursor-pointer bg-blue-300 rounded-2m p-5 hover:scale-90">
// 수정 예시
<button className="cursor-pointer bg-blue-300 rounded-2xl p-5 hover:scale-90">
rounded-2m은 존재하지 않는 Tailwind 클래스입니다 !
이외에도 사용하지 않는 import문이나 console.log문은 지워주시면 더 좋을 것 같습니다 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 주차 / 미션
📌 작업 내용
✨ 상세 작업 내용
📸 스크린샷
❓ 리뷰어가 알아야 할 사항 / 질문
✅ 체크리스트