The formIsValid function has the responsibility to determine if the passed submitFunction will be called or not.
- Iterates through VALUES and checks if all are not empty.
- Iterates through ERRORS and checks if all are empty.
The problem is that not all consumers of useForm require every input field, some allow the form to be submitted with some input fields empty. Passing formIsValid as a parameter will bypass this problem
However, it will have an arbitrary value/function which is the checking of values and errors. Consumers that do not want every input field to be required will pass a value/function to formIsValid.
The formIsValid function has the responsibility to determine if the passed submitFunction will be called or not.
The problem is that not all consumers of useForm require every input field, some allow the form to be submitted with some input fields empty. Passing formIsValid as a parameter will bypass this problem
However, it will have an arbitrary value/function which is the checking of values and errors. Consumers that do not want every input field to be required will pass a value/function to formIsValid.