[5주차/동동] 워크북 제출합니다.#48
Open
bukyung03 wants to merge 3 commits intoUMC-Inha:동동/mainfrom
Open
Conversation
aeongiing
reviewed
May 1, 2026
kcleverp
reviewed
May 2, 2026
OscarKang1
reviewed
May 2, 2026
qkrdmsthff
approved these changes
May 4, 2026
Collaborator
qkrdmsthff
left a comment
There was a problem hiding this comment.
LGTM 동동 !! 열심히 하셨네용 수고 많으셨어요 이번주도 화이팅 ~~
Comment on lines
+10
to
+18
| const NicknameStep = ({ onSubmit, isLoading }: Props) => { | ||
| const { | ||
| register, | ||
| handleSubmit, | ||
| formState: { errors, isValid }, | ||
| } = useForm<NicknameFormValues>({ | ||
| resolver: zodResolver(nicknameSchema), | ||
| mode: 'onChange', | ||
| }); |
Collaborator
There was a problem hiding this comment.
mode : 'onChange' 와 isValid 를 조합해서 사용 시 매 타이핑마다 유효성 검사가 실행되어 성능에 미세한 영향을 줄 수 있습니다! 현재는 폼의 크기가 작아서 괜찮지만 폼의 크기가 커진다면,
=> isDirty && isValid 를 사용하여 체크하는 것이 더 좋을 수 있습니다.
Comment on lines
+37
to
+43
| const[accessToken, setAccessToken] = useState<string|null>( | ||
| // 지연 초기화하는 이유? LocalStorage 값은 한번 값을 받으면 계속해서 리렌더링될 필요가 없음 | ||
| getAccessTokenFromStorage(), // 함수를 넣어줘야 지연 초기화가 됨 | ||
| ); | ||
| const[refreshToken, setRefreshToken] = useState<string|null>( | ||
| getRefreshTokenFromStorage(), | ||
| ); |
Collaborator
There was a problem hiding this comment.
함수를 넣어줘야 지연 초기화가 됨이라고 표기하였는데, 지금 해당 코드는 매 렌더링마다 함수가 호출되고 있습니다!
useState<string|null>(() => getRefreshTokenFromStorage());
해당 코드처럼 수정하면 최초 마운트 시에만 호출되도록 할 수 있습니다!
| setAccessToken(newAccessToken); | ||
| setRefreshToken(newRefreshToken); | ||
| toast.success("로그인 성공"); | ||
| window.location.href="/my"; |
Collaborator
There was a problem hiding this comment.
현재 SPA 의 장점을 무시하고 window.location.href 를 사용해서 페이지를 이동하고 있습니다! react-route-dom 의 useNavigate 훅을 사용해 보는 것을 권장합니다!
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.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점