---
title: Deploying React Forms Using Formspree with Vercel
description: Create and deploy a React form with the help of Formspree and Vercel.
url: /kb/guide/deploying-react-forms-using-formspree-with-vercel
canonical_url: "https://vercel.com/kb/guide/deploying-react-forms-using-formspree-with-vercel"
published: 2025-11-03
last_updated: 2025-11-10
authors: Matthew Sweeney
related:
  - /docs/concepts/deployments/git
  - /docs/concepts/deployments/preview-deployments
  - /docs/concepts/deployments/environments
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Create React App](https://vercel.com/docs/frameworks/frontend/create-react-app?from=related) — Learn how to use Vercel's features with Create React App
- [Formspree](https://vercel.com/docs/integrations/cms/formspree?from=related) — Learn how to integrate Formspree with Vercel. Follow our tutorial to set up Formspree and manage form submissions on you
- [Form Submissions](https://vercel.com/docs/botid/form-submissions?from=related) — How to properly handle form submissions with BotID protection
- [Using Comments](https://vercel.com/docs/comments/using-comments?from=related) — This guide will help you get started with using Comments with your Vercel Preview Deployments.
- [Sitecore](https://vercel.com/docs/integrations/cms/sitecore?from=related) — Integrate Vercel with Sitecore XM Cloud to deploy your content.
- [Triage form submissions with Chat SDK](https://vercel.com/kb/guide/triage-form-submissions-with-chat-sdk?from=related) — Build a Slack bot that triages form submissions with interactive cards. Forward, edit, or mark as spam without leaving S
- [How to Deploy a Preact Site with Vercel](https://vercel.com/kb/guide/deploying-preact-with-vercel?from=related) — Create your Preact app and deploy it with Vercel.
- [Deploying React with Vercel](https://vercel.com/kb/guide/deploying-react-with-vercel?from=related) — Deploy React with Vercel to replace your build pipeline and shared staging. See how framework detection, previews, and F
- [Using SvelteKit Form Actions](https://vercel.com/kb/guide/using-sveltekit-form-actions?from=related) — This guide explains how to use form actions in SvelteKit to handle form submissions, process form data, and enhance form
- [Deploying Real-Time Apps with Pusher Channels and Vercel](https://vercel.com/kb/guide/deploying-pusher-channels-with-vercel?from=related) — How to get started building and deploying real-time apps with Channels on Vercel.

Full cross-link map for this page: [/kb/guide/deploying-react-forms-using-formspree-with-vercel.graph.md](/kb/guide/deploying-react-forms-using-formspree-with-vercel.graph.md)
<!-- /docsgraph:related -->


[Formspree](https://formspree.io/) is a form backend that sends submissions via email which can connect to several third-party services such as Google Sheets, MailChimp, Slack, and more. Formspree also provides spam mitigation and filtering, file upload, automatic responses, and other tools to help you manage your forms.

In this guide, you will discover how to create a "contact us" form using [React](https://reactjs.org/), similar to the [example app](https://react-formspree.now-examples.vercel.app/), handle the form submission with [Formspree](https://formspree.io/) and deploy it with Vercel.

## Step 1: Creating a New Formspree form

Get started integrating Formspree with Vercel by using the [Create a Form with Vercel page](https://formspree.io/create/zeit). Add the email you would like to receive form submissions at and create your form.

Formspree will first ask you to provide a password, then you will be redirected to an integration page where you can get your form URL.

Make a note of your form's endpoint. This will be used later to submit the form you build.

Go to your form's **Settings** to find the reCAPTCHA setting and toggle it off. To use AJAX on Formspree you must either disable reCAPTCHA or provide your own reCAPTCHA key.

> **Note:** You can find more information on using reCAPTCHA with AJAX in the Formspree [documentation](https://help.formspree.io/hc/en-us/articles/360022811154-Adding-a-custom-reCAPTCHA-key).

## Step 2: Building Your Form

Create a React app from your terminal with [Create React App](https://reactjs.org/docs/create-a-new-react-app.html):

```bash
npm init react-app my-formspree-app && cd my-formspree-app
```
```bash
npm install axios
```

Create a `ContactForm.js` file in the `/src` directory with the code below:

```jsx
import React, { useState } from 'react';
import axios from 'axios';

export default () => {
  const [status, setStatus] = useState({
    submitted: false,
    submitting: false,
    info: { error: false, msg: null },
  });
  const [inputs, setInputs] = useState({
    email: '',
    message: '',
  });
  const handleServerResponse = (ok, msg) => {
    if (ok) {
      setStatus({
        submitted: true,
        submitting: false,
        info: { error: false, msg: msg },
      });
      setInputs({
        email: '',
        message: '',
      });
    } else {
      setStatus({
        info: { error: true, msg: msg },
      });
    }
  };
  const handleOnChange = (e) => {
    e.persist();
    setInputs((prev) => ({
      ...prev,
      [e.target.id]: e.target.value,
    }));
    setStatus({
      submitted: false,
      submitting: false,
      info: { error: false, msg: null },
    });
  };
  const handleOnSubmit = (e) => {
    e.preventDefault();
    setStatus((prevStatus) => ({ ...prevStatus, submitting: true }));
    axios({
      method: 'POST',
      url: 'https://formspree.io/[your-formspree-endpoint]',
      data: inputs,
    })
      .then((response) => {
        handleServerResponse(
          true,
          'Thank you, your message has been submitted.',
        );
      })
      .catch((error) => {
        handleServerResponse(false, error.response.data.error);
      });
  };
  return (
    <main>
      <h1>React and Formspree</h1>
      <hr />
      <form onSubmit={handleOnSubmit}>
        <label htmlFor="email">Email</label>
        <input
          id="email"
          type="email"
          name="_replyto"
          onChange={handleOnChange}
          required
          value={inputs.email}
        />
        <label htmlFor="message">Message</label>
        <textarea
          id="message"
          name="message"
          onChange={handleOnChange}
          required
          value={inputs.message}
        />
        <button type="submit" disabled={status.submitting}>
          {!status.submitting
            ? !status.submitted
              ? 'Submit'
              : 'Submitted'
            : 'Submitting...'}
        </button>
      </form>
      {status.info.error && (
        <div className="error">Error: {status.info.msg}</div>
      )}
      {!status.info.error && status.info.msg && <p>{status.info.msg}</p>}
    </main>
  );
};
```

This form takes two inputs, the user email and message, using `axios` to make the [POST request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) with the submission data to the Formspree endpoint received earlier on.

> **Note:** Make sure to replace `your-formspree-endpoint` with the endpoint received in Step 1.

Now you just need to use the form in your app. Change the contents of the `App.js` file to the following:

```jsx
import React from 'react';
import ContactForm from './ContactForm';

export default function App() {
  return (
    <div>
      <ContactForm />
    </div>
  );
}
```

> **Note:** If you wish to use the same styles as our [example app](https://react-formspree.now-examples.vercel.app/), you can find them [here](https://react-formspree.now-examples.vercel.app/styles/index.css).

## Step 3: Deploy With Vercel

To deploy your React + Formspree app with [Vercel for Git](https://vercel.com/docs/concepts/deployments/git), make sure it has been pushed to a Git repository.

Import the project into Vercel using your [Git provider](https://vercel.com/import/git) of choice.

After your project has been imported, all subsequent pushes to branches will generate [Preview Deployments](https://vercel.com/docs/concepts/deployments/preview-deployments#), and all changes made to the [Production Branch](https://vercel.com/docs/concepts/deployments/git#production-branch) (commonly "main") will result in a [Production Deployment](https://vercel.com/docs/concepts/deployments/environments#production).

Form submissions received from either your localhost or production environments will be emailed, and show up in your form submissions list. If you want to restrict where the form can be embedded, set your production URL in the authorized domains setting in Formspree.

## Bonus: Special Formspree Names

Formspree allows you to provide specially named inputs to **control how form submissions are processed**.

Below is a list some of the most commonly used values, but you can find all of them in the [Form Setup section](https://help.formspree.io/hc/en-us/sections/115002389908-Form-setup) of the Formspree [help guide](https://help.formspree.io/hc/en-us).

### `name="_replyto"`

Use this name to set the Reply-To email address of the submission notification emails.

This allows you to quickly reply to form submissions in your inbox and is shown in the example below.

```html
<input type="email" name="_replyto" placeholder="your email address">
```

### `name="_subject"`

Use this name to set the subject of notification emails. This will override the default **New submission from …** subject.

> **WARNING:** You should place this in a hidden input as done in the example below.

```html
<input type="hidden" name="_subject" value="New lead on mysite.com">
```