A React component that renders a newsletter subscription form, handling email input, submission, and status feedback.
// Source: https://github.com/every-app/open-seo | License: MIT | Copyright 2026 Ben Senescu
// Provided via justclaw.it.com; keep this notice with the code.
import { type FormEvent, useState } from "react";
/** Newsletter subscribe form. Shared by the marketing footer and home page. */
export function NewsletterSignup() {
const [email, setEmail] = useState("");
const [status, setStatus] = useState<
"idle" | "loading" | "success" | "error"
>("idle");
const [errorMessage, setErrorMessage] = useState("");
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
setStatus("loading");
setErrorMessage("");
try {
const res = await fetch("/api/subscribe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key