Uncaught TypeError: Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.
is because the parameter it expects is a form element.
I can see you have const form = useRef(null);, but I can't see anywhere that you actually set that reference to your form. You need to use forwardRef in your WebForm component to target the form.
This way you can them put a ref on your component to gain access to the form element nested within it. Assuming you've forwarded the ref, you can then write <WebForm ref={form} ... /> which should then ensure your submit function gets all the form data when submitting to your endpoint.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The reason you get the error
is because the parameter it expects is a form element.
I can see you have
const form = useRef(null);, but I can't see anywhere that you actually set that reference to yourform. You need to useforwardRefin yourWebFormcomponent to target theform.This way you can them put a ref on your component to gain access to the form element nested within it. Assuming you've forwarded the ref, you can then write
<WebForm ref={form} ... />which should then ensure your submit function gets all the form data when submitting to your endpoint.