You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’d like to propose a new method for React Hook Form: getErrors. This method would function similarly to getValues, but instead of retrieving form values, it would return the current form errors for a given field or all fields.
Why It’s Useful:
No re-renders: Unlike useFormState, which subscribes to form state and can trigger re-renders, getErrors would provide a snapshot of the current errors on demand—ideal for non-reactive use cases.
On-demand access: Perfect for accessing validation errors during function calls like onSubmit, custom validations, or conditional logic outside of the render cycle.
Developer ergonomics: Cleaner and more intuitive than subscribing to error state when only occasional access is needed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Overview:
I’d like to propose a new method for React Hook Form: getErrors. This method would function similarly to getValues, but instead of retrieving form values, it would return the current form errors for a given field or all fields.
Why It’s Useful:
Example usage:
This would make form handling more flexible, especially in performance-sensitive scenarios where avoiding unnecessary renders is important.
Beta Was this translation helpful? Give feedback.
All reactions