Simple React Contact Form

In this guide, you will learn how to setup a simple working contact form using React Framework and Web3Forms. No need to setup an SMTP or Custom Backend or Server. It all happens in the front end. You can copy paste to your react app and it will work.

Here's the code:

import React from "react";

function App() {
  const [result, setResult] = React.useState("");

  const onSubmit = async (event) => {
    const formData = new FormData(;

    formData.append("access_key", "YOUR_ACCESS_KEY_HERE");

    const response = await fetch("", {
      method: "POST",
      body: formData

    const data = await response.json();

    if (data.success) {
      setResult("Form Submitted Successfully");;
    } else {
      console.log("Error", data);

  return (
      <form onSubmit={onSubmit}>
        <input type="text" name="name" required/>
        <input type="email" name="email" required/>
        <textarea name="message" required></textarea>

        <button type="submit">Submit Form</button>



export default App;

Last updated