Submits a fetcher <form> to the server without reloading the page.

  • Parameters

    • target: SubmitTarget

      Can be multiple types of elements and objects

      HTMLFormElement

      <fetcher.Form
      onSubmit={(event) => {
      fetcher.submit(event.currentTarget);
      }}
      />

      FormData

      const formData = new FormData();
      formData.append("myKey", "myValue");
      fetcher.submit(formData, { method: "post" });

      Plain object that will be serialized as FormData

      fetcher.submit({ myKey: "myValue" }, { method: "post" });
      

      Plain object that will be serialized as JSON

      fetcher.submit(
      { myKey: "myValue" },
      { method: "post", encType: "application/json" }
      );
    • Optionaloptions: FetcherSubmitOptions

    Returns Promise<void>