menu

React Hook Form

📋 Custom React hooks for form validation without the hassle

Channels
Team
Posts
Chat
Members
Info
down-caret
·124d·Pinned# General

Support us by leaving a start ⭐️@github

React Hook Form is backed by our contributors, team members and myself. If you find React Hook Form to be useful in your React project, please star to support the repo and contributors ❤ Help us to help you better. …

thumbsup
44
message-simple
0

Return a promise in handleSubmit

I'm using the option "editable" of material-table, and I want to submit the form when the OK button is pressed, so I have something like this: The problem is that onRowUpdate needs to return a promise, if it's resolved the edit row closes, if it's rejected the edit row remains…

thumbsup
0
message-simple
19

How to clear errors in onChange inside Controller?

Hi , I have a text field where user has to enter the value in combination of alphabets and number for that i added a input mask using react-input-mask . So that i wrapped the input field with Controller. OnSumbit the required errors will pop up. After as soon as the user starts…

thumbsup
0
message-simple
11

Combining `validationSchema` and `rules` from Controller/register

Hey all! I'm basically using validation schema, as described here: https://react-hook-form.com/advanced-usage#SchemaValidation But now I need to implement rules to use watch() inside, that is not available in schema/yup. Could you please advice me a best approach for that? rules…

thumbsup
0
message-simple
4

How to show common field error validation ?

Eg: I am having four Form Fiels [ Name , Age , DOB ,Gender]. Instead of showing , this field is required ,error message , below that field. I need to show a common error message all fields are required.

thumbsup
0
message-simple
16

Recursive form fields, problems with `useFieldArray`

I have a recursive component structure, where there are <Field> and <ListField> components, where the ListField uses useFieldArray and each list item is made up of multiple <Field> and/or <ListField> components. My forms are generated at runtime, driven by config (ie: form…

thumbsup
0
message-simple
24

watch is not memoized

Component re-render trigger redefinition of watch variable. It may not be ideal in certain case when some useEffect depends on watch - Maybe I miss something. https://codesandbox.io/s/react-hook-form-basic-dnkc2?file=/src/index.js

thumbsup
0
message-simple
22

during Validation, Component is rerender or remounted to show error message?

Hello, I want to know when we submit the form and some registered field is empty so when RHF shows error for required on DOM Does it Rerender the Component or Remount the Component?

thumbsup
0
message-simple
4

How to persist form data with react-modal

I use RHF with react-modal. If a user closes modal without submitting the form, I want to persist form data until a browser reloaded and then if the user opens modal again, they can see previous data user inputted. How should I do that? …

thumbsup
0
message-simple
25

How to set default values using the data from api?

The data from API is fetched in 'useEffect', but if i use reset in 'useEffect', nothing happens, the form is empty.

thumbsup
0
message-simple
5

Difference between `defaultValuesRef` and `defaultRenderValuesRef`?

What is the difference between defaultValuesRef and defaultRenderValuesRef in useForm.ts?

thumbsup
0
message-simple
1