충남대 FE_강병현 4주차 과제 Step3#101
Open
kang-kibong wants to merge 30 commits intokakao-tech-campus-2nd-step2:kang-kibongfrom
Open
충남대 FE_강병현 4주차 과제 Step3#101kang-kibong wants to merge 30 commits intokakao-tech-campus-2nd-step2:kang-kibongfrom
kang-kibong wants to merge 30 commits intokakao-tech-campus-2nd-step2:kang-kibongfrom
Conversation
taehwanno
reviewed
Jul 21, 2024
Comment on lines
+18
to
+19
| {...register('message')} | ||
| maxLength={MAX_MESSAGE_LENGTH} |
There was a problem hiding this comment.
Suggested change
| {...register('message')} | |
| maxLength={MAX_MESSAGE_LENGTH} | |
| {...register('message', { maxLength: MAX_MESSAGE_LENGTH })} |
해당 방향도 가능하긴 한데, 가급적이면 useForm의 register option으로 전달해주는게 확실한 방법이라 개선해보는게 좋겠습니다.
| <option value="개인소득공제">개인소득공제</option> | ||
| <option value="사업자증빙용">사업자증빙용</option> | ||
| </Select> | ||
| <Input placeholder="(-없이) 숫자만 입력해주세요." mb={4} {...register('cashReceiptNumber')} /> |
There was a problem hiding this comment.
숫자 입력하다가 enter를 누르면 페이지가 새로고침되는데 한번 개선해보시겠어요?
| <form> | ||
| <Checkbox mb={4} fontWeight={700} {...register('hasCashReceipt')}> | ||
| 현금영수증 신청 | ||
| </Checkbox> |
There was a problem hiding this comment.
현금영수증을 신청해야 cashReceiptType와 cashReceiptNumber를 입력하는게 의미가 있으니, 현금영수증이 체크되어 있을 때만 화면에 보이도록 개선해보는게 어떨까요? 사용자에게 불필요한 안내는 최대한 줄여보는게 좋을 거 같아요.
| const { message, hasCashReceipt, cashReceiptNumber } = watch(); | ||
|
|
||
| const handleOrderClick = () => { | ||
| const errorMessage = validatePayment(message, hasCashReceipt, cashReceiptNumber); |
There was a problem hiding this comment.
사용자가 입력한 값에 대한 유효성 검사를 결제하기 버튼을 눌렀을 때 다시 진행하고 있는데요, react-hook-form에서 제공해주는 validation 기능을 활용해서 처리하고 결제하기 이벤트가 발생했을 때 대응하는 핸들러 안에서는 유효성 검사를 따로 하지 않도록 코드를 개선해보시겠어요?
react-hook-form을 통해 처리하게 되면 유효성 검사 조건을 선언적으로 처리할 수 있어요.
|
#74 병합 후 충돌 발생하고 있어서 해결되면 병합하도록 하겠습니다. |
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.
No description provided.