Skip to content

Tag: react-hook-form

Perform function after form validation

I am using react, typescript, and Email JS library. I am using the react-hook-form library and yup to validate forms. I have worked out the validation and sending the email, but I am unable to do both these functions together. When a user submits the form, I want the “sendEmail” function to be called if the “handleSubmit(onSubmit)” function which validates

React-Hook Form: How do I convert the value of the quantity into a number that is inside the useFieldArray?

I have already declared the input to only receive numbers: But this would still save as a string. How can I convert the value of the quantity into a number or if I could parse this into an integer? The quantity input field is in the nestedFieldArray I recreated this in: This is what the data looks like in

React-Hook Form with useFieldArray: TextField value does not show up in the console. How can I fix it?

I wanted to enter the word Product but when I submit it, it does not show up in the console. What shows up in the console: As you can see here, the word Product does not appear in the console. Any idea on how I can solve this? This is the codesandbox link: this is the fieldArray.js where the

How to input only number in react-hook-form

I’m using react-hook-form for my input components, but there is one problem. In some text field, for example, text field for validation that take only number, i don’t know how to do that, with normal textInput, we can use regex, like and put that function and hook value on onTextChange and value respectively , i tried same method above on