React multi-step form

Build a multi-step form in React with no backend. Collect fields across steps in component state, then post once to Formpaste at the end. Copy the wizard code and add your access key.

Step 1 of 3

How to build it

  1. Create a form in your Formpaste dashboard and copy its access key.
  2. Copy the multi-step component below into your app.
  3. Replace YOUR_ACCESS_KEY_HERE with your access key, then deploy.

Prompt for your AI coding agent

Add a Formpaste multi-step form to my React app. Use a component that collects name, email and message across several steps in local state with Next and Back buttons, then POSTs once at the end as application/x-www-form-urlencoded (URLSearchParams) to https://api.formpaste.com/submit with a hidden access_key. Do not post on every step and do not add a backend.

Or connect the Formpaste MCP server to Claude Code, Codex, Cursor, Claude Desktop, VS Code, or any mcp-remote client. See the setup guide.

React gotchas

A React contact form is just a component with a submit handler that POSTs to Formpaste. There is no backend and no API route of your own. Put the fetch in a component that runs in the browser and you are done.

It is a client component

The onSubmit fetch runs in the browser, so the form lives in a normal client component. In a plain React SPA every component is already client-side; in a framework with server components, add the client boundary where the fetch runs.

No API route, no proxy

You do not POST to your own /api endpoint and forward from there. The component posts straight to the Formpaste endpoint, which removes a whole server round-trip and a mailer you would otherwise write.

Controlled or uncontrolled, both work

Read values from a FormData over the form element (uncontrolled) or from useState (controlled). Uncontrolled is less code for a simple contact form; controlled is handy when you validate as the user types.

Handle the response in state

The endpoint returns JSON (success, message, id). Await the fetch and set a piece of state to show your own success or error UI, or set a redirect in the dashboard and skip the client handling.

What to get right

One form, several screens

A multi-step form is a single submission split across steps in the UI. Collect all the fields in client state, then post once at the end.

Route per step is optional

You can give each step its own URL for back-button support, or keep it all on one page with local state. Both post the same final payload.

Post the whole payload once

Do not post on every step. Gather the fields as the user advances and send one request when they finish.

How it works

Three simple steps for form submissions to land in your email inbox.
Create your form, set your form's action URL to Formpaste's endpoint, and add your access key.

1

Create your form

Sign up, verify your email, and create an access key in your dashboard.

2

Copy the code

Paste the snippet above into your project. Pick CSS or Tailwind to match your site.

import { useState } from "react";

const ENDPOINT = "https://api.formpaste.com/submit";

export function MultiStepForm() {
  const [step, setStep] = useState(0);
  const [data, setData] = useState({ name: "", email: "", message: "" });
  const set = (k, v) => setData((d) => ({ ...d, [k]: v }));

  async function submit(e) {
    e.preventDefault();
    const body = new URLSearchParams({ access_key: "YOUR_ACCESS_KEY_HERE", ...data });
    await fetch(ENDPOINT, { method: "POST", body });
  }

  return (
    <form onSubmit={submit}>
      {step === 0 && (
        <input value={data.name} onChange={(e) => set("name", e.target.value)} placeholder="Name" required />
      )}
      {step === 1 && (
        <input type="email" value={data.email} onChange={(e) => set("email", e.target.value)} placeholder="Email" required />
      )}
      {step === 2 && (
        <textarea value={data.message} onChange={(e) => set("message", e.target.value)} placeholder="Message" />
      )}
      {step < 2 ? (
        <button type="button" onClick={() => setStep((s) => s + 1)}>Next</button>
      ) : (
        <button type="submit">Submit</button>
      )}
    </form>
  );
}
3

Add your access key

Replace the placeholder with your access key to start receiving submissions.

<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">

React multi-step form FAQ

Paste a form. Get submissions.

Instantly without setting up any backend, servers or databases. 250 submissions/mo free - no credit card.

Other React forms