-
Notifications
You must be signed in to change notification settings - Fork 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
경북대 FE_이효은 4주차 과제 Step3 #95
base: hyoeunkh
Are you sure you want to change the base?
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.
고생하셨습니다~! 리뷰 남깁니다.
</Route> | ||
</Routes> | ||
</AuthProvider> | ||
<FormProvider {...methods}> |
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.
FormProvider가 필요 이상으로 상위에 위치하는 것은 아닐까요?
const onSubmit = (value: FormValues) => { | ||
if (value.message && value.message.length > 100) { | ||
alert('메시지는 100자 이내로 입력해주세요.'); | ||
return; | ||
} | ||
if (!value.message) { | ||
alert('메시지를 입력해주세요.'); | ||
return; | ||
} | ||
if (value.cashReceipt && !value.number) { | ||
alert('현금영수증 번호를 입력해주세요'); | ||
return; | ||
} | ||
if (isNaN(Number(value.number))) { | ||
alert('현금영수증 번호는 숫자로만 입력해주세요.'); | ||
return; | ||
} | ||
alert('주문이 완료되었습니다.'); | ||
}; | ||
|
||
const totalPrice = data.detail.price.basicPrice * orderHistory.count; | ||
|
||
return ( | ||
<PaymentSectionWrapper> | ||
<Title>결제 정보</Title> | ||
<Divider color="#e6e6e6" /> | ||
<form onSubmit={handleSubmit(onSubmit)}> |
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.
handleSubmit의 첫번째 인자는 onValid로, 유효성 검사를 통과할 경우 호출되는 콜백입니다.
hook-form의 유효성 검사에 의존하지 않고 사용법과 다르게 유효성을 검사하는 이유가 있을까요??
안녕하세요 멘토님,
step3,4 제출합니다. 감사합니다 :)