Preact logo

A backend for your Preact forms

Keep full control over the look and feel of your Preact forms.

Preact is a JavaScript library that describes itself as a fast 3kB alternative to React with the same modern API.

Getting started with Preact is simple

Start collecting data in a matter of clicks.

Let Formspark take care of the servers, databases, and analytics.

Set up any form in seconds.

ReactOut of the box React support

jsx
import { useState } from "preact/hooks";

const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

export function ContactForm() {
  const [message, setMessage] = useState("");
  const [submitting, setSubmitting] = useState(false);

  const onSubmit = async (e) => {
    e.preventDefault();
    setSubmitting(true);
    try {
      await fetch(FORMSPARK_ACTION_URL, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ message }),
      });
      setMessage("");
    } finally {
      setSubmitting(false);
    }
  };

  return (
    <form onSubmit={onSubmit}>
      <textarea
        value={message}
        onInput={(e) => setMessage(e.currentTarget.value)}
      />
      <button type="submit" disabled={submitting}>
        Send
      </button>
    </form>
  );
}
Start collecting submissions with Formspark

Formspark is a reliable backend for your forms.

Keep full control over the look and feel of your forms.

Let Formspark take care of the rest.

No credit card required