Skip to content
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 #101

Open
wants to merge 30 commits into
base: kang-kibong
Choose a base branch
from

Conversation

kang-kibong
Copy link

No description provided.

Copy link

@taehwanno taehwanno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. 피드백 드려요.

Comment on lines +18 to +19
{...register('message')}
maxLength={MAX_MESSAGE_LENGTH}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

숫자 입력하다가 enter를 누르면 페이지가 새로고침되는데 한번 개선해보시겠어요?

<form>
<Checkbox mb={4} fontWeight={700} {...register('hasCashReceipt')}>
현금영수증 신청
</Checkbox>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현금영수증을 신청해야 cashReceiptType와 cashReceiptNumber를 입력하는게 의미가 있으니, 현금영수증이 체크되어 있을 때만 화면에 보이도록 개선해보는게 어떨까요? 사용자에게 불필요한 안내는 최대한 줄여보는게 좋을 거 같아요.

const { message, hasCashReceipt, cashReceiptNumber } = watch();

const handleOrderClick = () => {
const errorMessage = validatePayment(message, hasCashReceipt, cashReceiptNumber);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용자가 입력한 값에 대한 유효성 검사를 결제하기 버튼을 눌렀을 때 다시 진행하고 있는데요, react-hook-form에서 제공해주는 validation 기능을 활용해서 처리하고 결제하기 이벤트가 발생했을 때 대응하는 핸들러 안에서는 유효성 검사를 따로 하지 않도록 코드를 개선해보시겠어요?

react-hook-form을 통해 처리하게 되면 유효성 검사 조건을 선언적으로 처리할 수 있어요.

Copy link

@taehwanno taehwanno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

피드백 드려요!

@taehwanno
Copy link

#74 병합 후 충돌 발생하고 있어서 해결되면 병합하도록 하겠습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants