Can be multiple types of elements and objects
HTMLFormElement
<Form
onSubmit={(event) => {
submit(event.currentTarget);
}}
/>
FormData
const formData = new FormData();
formData.append("myKey", "myValue");
submit(formData, { method: "post" });
Plain object that will be serialized as FormData
submit({ myKey: "myValue" }, { method: "post" });
Plain object that will be serialized as JSON
submit(
{ myKey: "myValue" },
{ method: "post", encType: "application/json" }
);
Optionaloptions: SubmitOptionsOptions that override the <form>'s own attributes. Required when
submitting arbitrary data without a backing <form>.
Submits a HTML
<form>to the server without reloading the page.