-
Notifications
You must be signed in to change notification settings - Fork 128
Fix: Avoid implicit type coercion in validation logic examples #65
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
Conversation
@minseong0324 is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
code/examples/form-fields.md
Outdated
@@ -38,7 +38,8 @@ export function Form() { | |||
<div> | |||
<input | |||
{...register("name", { | |||
validate: (value) => (!value ? "이름을 입력해주세요." : ""), | |||
validate: (value) => | |||
(value.trim() === "" ? "이름을 입력해주세요." : ""), |
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.
I think it would be good if "Please enter your name." is displayed even when the value is nullish.
How about handling this with a utility function like isEmptyStringOrNil(value)?
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.
Thanks for your good comment. I applied isEmptyStringOrNil function to verify nullish value.
6230fcb
to
2559593
Compare
2559593
to
663c6a9
Compare
…mentals into chore/implicit-coercion
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.
@minseong0324 Thank you for accepting the feedback. LGTM 🚀
!value
) in the validation logic with an explicit comparison usingvalue.trim() === ""
.ref: #21