-
Notifications
You must be signed in to change notification settings - Fork 10
[4주차/유징] 워크북 제출합니다. #47
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: 유징/main
Are you sure you want to change the base?
Conversation
{step === 1 && <EmailStep onNext={handleEmailNext} />} | ||
{step === 2 && ( | ||
<PasswordStep onNext={handlePasswordNext} onPrev={() => setStep(1)} /> | ||
)} | ||
{step === 3 && ( | ||
<NicknameStep | ||
onSubmit={handleNameSubmit} | ||
onPrev={() => setStep(2)} | ||
email={collected.email!} | ||
/> | ||
)} |
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.
저는 이 페이지를 구현할 때 컴포넌트를 분리하지 못해서 코드의 가독성이 좀 떨어졌었는데 이런 식으로 깔끔하게 구현할 수 있었네요. 꼭 다른 폴더로 분리하지 않아도 하나의 페이지 안에서 해결할 수 있는 좋은 방식이네요 !
controllerRef.current?.abort(); | ||
controllerRef.current = new AbortController(); | ||
|
||
try { |
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.
controllerRef를 통해 기존 요청을 중단하고 새 요청으로 교체하는 구조가 아주 좋습니다.
다만 에러 발생 후 재요청 시 이전 에러 상태가 유지되지 않도록, setIsError(false)를 통해 에러 상태를 수동으로 초기화하는 것을 추천합니다
@@ -0,0 +1,34 @@ | |||
import { ChangeEvent, useEffect, useState } from "react"; | |||
|
|||
interface UseFormProps<T> { |
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.
제너릭(T)을 활용해 useForm 훅이 다양한 폼 구조에 재사용될 수 있도록 설계한 부분이 정말 좋습니다.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점