Assume, there is a form-level validation for fields - this is zod. Another validation happens during submit - backend API can return submission errors, e.g. "username taken".
How can I store and handle those backend errors? I was thinking
useState
useState
with backend errors which are returned in another form-level validator. However, having any errors in the form will block submission (
canSubmit
canSubmit
is then
false
false
and
onSubmit
onSubmit
won't be triggered).
Am I missing any obvious solution? Beside clearing each field backend errors on change - I would prefer to handle it on form level instead of pushing listeners to each field.