FormDrop › Guides › React contact form without a backend

React contact form without a backend

In a React app (Vite, CRA or any SPA) you can post to FormDrop with fetch and show the success state without a page reload.

A complete component

import { useState } from "react";

export default function ContactForm() {
  const [status, setStatus] = useState("idle");
  async function onSubmit(e) {
    e.preventDefault();
    setStatus("sending");
    const body = Object.fromEntries(new FormData(e.currentTarget));
    const res = await fetch("https://forms.elimbi.com/submit", {
      method: "POST",
      headers: { "Content-Type": "application/json", Accept: "application/json" },
      body: JSON.stringify({ ...body, access_key: "YOUR-ACCESS-KEY" }),
    });
    const data = await res.json();
    setStatus(data.success ? "sent" : "error");
  }
  if (status === "sent") return <p>Thanks! I'll get back to you soon.</p>;
  return (
    <form onSubmit={onSubmit}>
      <input name="name" required placeholder="Name" />
      <input name="email" type="email" required placeholder="Email" />
      <textarea name="message" required placeholder="Message" />
      <input type="checkbox" name="botcheck" style={{ display: "none" }} tabIndex={-1} />
      <button disabled={status === "sending"}>Send</button>
      {status === "error" && <p>Something went wrong. Please try again.</p>}
    </form>
  );
}

Where to keep the key

The access key identifies where submissions go; it is meant to live in client code, like the HTML snippet. You can still keep it in an env variable (import.meta.env.VITE_FORMDROP_KEY) to switch keys between staging and production.

Supported fields

Every other field is included in the email and saved in your dashboard log. Send Accept: application/json to get a JSON reply instead of a redirect.

Test it

  1. Create a free access key with your email.
  2. Paste the key, deploy, submit a test message.
  3. Check your inbox and the dashboard log. If mail is delayed, the submission is still stored in the log.

Point your form at one URL and get every message by email. Free for 250 submissions a month.

Get a free access key

FAQ

Is it free?

Yes: 250 submissions/month and unlimited forms on the free plan. Pro is $9/mo for 10,000/month.

Can I upload files?

Not currently — FormDrop handles text fields. Link to a file share instead.

Does it work with JavaScript disabled?

The plain HTML form version does; the fetch version needs JS.

Related guides

Next.js contact form without a backendAstro contact form without a backendVue contact form without a backendHugo contact form without a backend