I'm having problems with validation errors using the new react-hook-form version 7 and was wondering if anyone can help (see example linked below).
https://codesandbox.io/s/react-hook-form-adapting-existing-form-forked-n3sis?file=/src/index.js
This all used to work until I updated from v6 to v7. I changed the way register was used, i.e. {...register('name', {required: 'Add this'})} instead of ref={register({required: 'Add this'})} and have updated getting the errors from formState now, i.e. const { formState: { errors }} = useForm(); instead of const { errors } = useForm();.
I'm pretty sure it's got something to do with me using a controlled component rather than just a native html <input /> but can't quite seem to figure it out.
Any help would be hugely appreciated. Thanks.