React Router API Reference
    Preparing search index...

    Interface SubmitFunction

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

    • Parameters

      • target: SubmitTarget

        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: SubmitOptions

        Options that override the <form>'s own attributes. Required when submitting arbitrary data without a backing <form>.

      Returns Promise<void>