E EasyFormAPI Docs Pricing Templates Integrations Get Started Free

React Contact Form API

Add a working contact form to any React application without building a backend. Call EasyFormAPI from your onSubmit handler and receive every submission by email instantly.

import { useState } from 'react';

export default function ContactForm() {
  const [status, setStatus] = useState('idle');

  async function handleSubmit(e) {
    e.preventDefault();
    setStatus('sending');
    const data = Object.fromEntries(new FormData(e.target));
    const res = await fetch('https://api.easyformapi.com/submit', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ access_key: 'YOUR_ACCESS_KEY', ...data }),
    });
    setStatus(res.ok ? 'sent' : 'error');
  }

  return (
    <form onSubmit={handleSubmit}>
      <input name="name"    type="text"  required placeholder="Name" />
      <input name="email"   type="email" required placeholder="Email" />
      <textarea name="message"           required placeholder="Message" rows={4} />
      <button type="submit" disabled={status === 'sending'}>
        {status === 'sending' ? 'Sending…' : 'Send Message'}
      </button>
      {status === 'sent'  && <p>Message sent!</p>}
      {status === 'error' && <p>Something went wrong. Please try again.</p>}
    </form>
  );
}

Framework Compatibility

  • Vite + React
  • Create React App
  • Next.js (App Router Client Component)
  • Remix
  • Gatsby
  • Preact (identical API)

Ready to receive form submissions by email?

Free plan: 250 submissions/month, spam protection, email notifications. No backend server required.

Get Your Free Access Key    Read the docs →

Frequently Asked Questions

How do I receive HTML form submissions by email without a backend?
Point your form's action attribute to https://api.easyformapi.com/submit, add a hidden access_key input, and every submission is delivered to your inbox instantly — no server, no PHP, no backend code required.
Is EasyFormAPI really free?
Yes. The free plan includes 250 form submissions per month with spam protection and email notifications. No credit card required. See all plans.
Does it work with React, Next.js and Vue?
Yes. Call the API endpoint from any onSubmit handler using fetch(). See guides for React, Next.js and Vue.
Do I need to configure an email server or SMTP?
No. EasyFormAPI handles email delivery on your behalf. You only need your EasyFormAPI access key.
What spam protection is included?
All plans include a honeypot filter. Pro plans additionally support hCaptcha and Google reCAPTCHA v3 verification. Spam protection docs.
How do I handle the form submission response in React?
The endpoint returns a JSON response with { "success": true } on success. Check res.ok or parse the JSON to update your component state.
Can I use FormData instead of JSON?
Yes. Post as multipart/form-data using the FormData API (required for file uploads). Omit the Content-Type header — the browser sets the correct boundary automatically.