useForm
Last updated
Last updated
The useForm hook is used inside the component. It uses the hook and is a specialized hook for submitting form data to the provided URL endpoint.
This hook is a public hook and available for the users to use.
It accepts a single parameter, a URL endpoint provided to fetch.
It returns the following:
updateData
-> a function to update form fields for controlled form.
submit
-> a function to submit the form data.
submitted
-> a state value which tells if the form is submitted or not.
returnValue
-> a function to return the value responded by the endpoint after submitting the form data.
As you can see above it uses the and hook of the React internally for toggling the state of each accordion label.