Open
Conversation
qkrdmsthff
approved these changes
Apr 13, 2026
Collaborator
qkrdmsthff
left a comment
There was a problem hiding this comment.
LGTM 챈니 피드백이 늦어졌네요 고생하셨고 merge 권한은 미리 부여드리겠습니다!
Comment on lines
+20
to
+42
| useEffect(() => { | ||
| const fetchDetails = async () => { | ||
| if (!movieId) return; | ||
| setIsPending(true); | ||
|
|
||
| try { | ||
| const [detailData, creditsData] = await Promise.all([ | ||
| getMovieDetails(movieId), | ||
| getMovieCredits(movieId), | ||
| ]); | ||
|
|
||
| setDetails(detailData); | ||
| setCredits(creditsData); | ||
| } catch { | ||
| setIsError(true); | ||
| } finally { | ||
| setIsPending(false); | ||
| } | ||
| }; | ||
|
|
||
| fetchDetails(); | ||
| }, [movieId]); | ||
|
|
Collaborator
There was a problem hiding this comment.
영화 상세 데이터를 가져오는 로직을 useMovieDetail 이라는 커스텀 훅으로 표현해 보면 MovieDetailPage 가 더욱 간결해지고 코드 가독성 및 재사용성이 증가할 것 같네요!
이번 미션 내용이 아마 해당 내용에 대한 커스텀 훅 적용이였을 텐데 한 번 수정해 보시면 좋을 것 같아용
jjeunv
reviewed
Apr 14, 2026
|
|
||
| //"email": true -> touch 됨 | ||
| //"password": false -> touch 안 됨 | ||
| const [touched, setTouched] = useState<Record<string, boolean>>(); |
There was a problem hiding this comment.
touched, errors의 초기값이 undefined로 되어 있는데, 현재 코드에서는 optional chaining이나 null 체크 없이 바로 사용하고 있습니다.
특히
setTouched({ ...touched, [name]: true })와 같이 spread 연산을 사용할 때, 초기 렌더링 시 touched가 undefined이면 TypeError가 발생할 수 있습니다.
초기값을 빈 객체로 설정하면 이러한 문제를 방지하고 더 안전하게 상태를 관리할 수 있을 것 같습니다!!
const [touched, setTouched] = useState<Record<string, boolean>>({});
const [errors, setErrors] = useState<Record<string, string>>({});위 코드의 경우 항상 객체 형태가 보장되기 때문에 처럼 안전하게 사용할 수 있어 더 안정적인 코드가 됩니다!!
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.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점