A backend for your Next.js forms
Keep full control over the look and feel of your Next.js forms.
Next.js is an open-source React front-end development web framework that enables functionality such as server-side rendering and generating static websites for React based web applications.
Getting started with Next.js 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.
Out of the box React support
Compatible with Jamstack
JSX
// app/contact/page.jsx "use client"; import { useState } from "react"; import { useFormspark } from "@formspark/use-formspark"; const FORMSPARK_FORM_ID = "your-form-id"; export default function ContactPage() { const [submit, submitting] = useFormspark({ formId: FORMSPARK_FORM_ID, }); const [message, setMessage] = useState(""); const onSubmit = async (e) => { e.preventDefault(); await submit({ message }); alert("Form submitted"); }; return ( <form onSubmit={onSubmit}> <textarea value={message} onChange={(e) => setMessage(e.target.value)} /> <button type="submit" disabled={submitting}> Send </button> </form> ); }
JSX
// pages/contact.jsx import { useState } from "react"; import { useFormspark } from "@formspark/use-formspark"; const FORMSPARK_FORM_ID = "your-form-id"; export default function ContactPage() { const [submit, submitting] = useFormspark({ formId: FORMSPARK_FORM_ID, }); const [message, setMessage] = useState(""); const onSubmit = async (e) => { e.preventDefault(); await submit({ message }); alert("Form submitted"); }; return ( <form onSubmit={onSubmit}> <textarea value={message} onChange={(e) => setMessage(e.target.value)} /> <button type="submit" disabled={submitting}> Send </button> </form> ); }
Links
- Check out the Formspark for Next.js documentation for more information.