A custom React hook for form handling with validation, submission, and data formatting.
Prop | Type | Description |
---|---|---|
register | Function | Registers a field for validation and tracking. Returns errors, value, and handleChange function. |
registerSubmit | Function | Registers a submit function to be called on form submission. |
handleSubmit | Function | Handles the form submission, validating fields before executing the submit function. |
handleAssistant | Function | Handles Enter key submission event. |
reset | Function | Resets the form data to the initial state. |
setForm | Function | Sets form data, filtering out invalid values. |
setFormData | Function | Directly updates the form data state. |
pending | Boolean | Indicates whether form submission is in progress. |
watch | Object | Tracks the current form state. |
errors | Object | Stores validation errors for each field. |