Skip to content
Discussion options

You must be logged in to vote

@Ekeu

The root cause is from line 19 of index.js, the method "test()" is using "value[0]" but at initial time, "value" is undefined therefore the validation will fail as an unexpected error.

While yup resolver from @hookform/resolvers is using "try catch" to wrap the execution of all validation rules, the unexpected error is catch but its error object from "catch" statement is not a validation error object (which is object with array data) and failed again with reduce method.

Just correcting the custom validation at line 19 will fix the error.

Working sample: https://codesandbox.io/s/react-hook-form-reset-v7-forked-i5ht5?file=/src/index.js

@bluebill1049 @jorisre

What do you think about a …

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@Ekeu
Comment options

@bluebill1049
Comment options

@Ekeu
Comment options

@Ekeu
Comment options

Comment options

You must be logged in to vote
4 replies
@Ekeu
Comment options

@leapful
Comment options

leapful Apr 27, 2021
Collaborator

@Ekeu
Comment options

@bluebill1049
Comment options

Answer selected by bluebill1049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants