Contact form · React
Contact form for React websites
Build a working contact form for your React website and send submissions straight to your inbox — in three steps, with no backend or server code. Works with Vite, Create React App, Remix, and Gatsby.
- 500 free / month
- One endpoint
- No backend code

How do you add a contact form to React?
To add a contact form to a React website, build a form component with a useState status flag and an onSubmit handler that POSTs FormData to a hosted form backend — no server of your own. Send it to https://splitforms.com/api/submit with your access key. Works in Vite, CRA, Remix, and Gatsby. Free for 500 submissions a month.
Key benefits
No backend code
No server, API route, or SDK. Your React form posts straight to one endpoint.
Straight to your inbox
Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it reaches you.
Design without limits
It's your own React markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.
Copy-paste ready
Your React contact form, ready to paste.
Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the jsx you already write.
How to add it
How to add a contact form to a React website.
To add a contact form to a React website you need three things: a free splitforms access key, the jsx snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.
Get your free splitforms access key
Sign up at splitforms.com, verify your email, and copy your access key from the dashboard. No credit card required.
Drop the React snippet into your project
Copy the React code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.
Receive submissions in your dashboard
Submissions arrive in the splitforms dashboard within seconds. Free includes owner email notification attempts; Pro adds Slack, Discord, Sheets, or any signed webhook URL.
Where submissions go
Where do your React form submissions go?
Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.
- 500 submissions a month, free to start
- Honeypot + automatic spam scoring on every plan
- Signed webhooks to Slack, Discord, your server

No backend needed
Do you need a backend for a React form? No.
Your React form posts standard FormData to one URL. Splitforms validates the access key, runs its spam checks, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.
- Works with Vite, Create React App, Remix, Gatsby
- Standard HTML5 validation built in
- Zero dependencies — just useState and fetch

Best practices
What a production-ready React form needs.
The difference between a form that works in the demo and one that survives launch traffic — the production-tested defaults, in priority order.
- Use a single status state variable: 'idle' | 'loading' | 'ok' | 'err'. Cleaner than 4 booleans.
- Show inline success/error messages instead of alert() — much better UX, easier to test, accessible.
- After successful submit, call e.target.reset() to clear the form. Users expect this; not doing it feels broken.

Does Splitforms work with Vite, Create React App, and Remix?
Yes — all three. The component code is identical. Vite uses import.meta.env.VITE_SPLITFORMS_KEY, CRA uses process.env.REACT_APP_SPLITFORMS_KEY, Remix uses process.env.SPLITFORMS_KEY (server-side via loader/action).
How do I handle CSRF in Splitforms?
Splitforms doesn't require a CSRF token because each access key has built-in domain locking (in dashboard → Settings → Allowed domains). Submissions from any other origin are rejected. That's CSRF protection without the token plumbing.
Can I use React Hook Form or Formik?
Yes — they're orthogonal. Use them for client-side validation, then on submit either pass the validated data through fetch to splitforms.com/api/submit, or have them call e.target.requestSubmit() to use the native form path. Splitforms only cares about field name → value pairs in the body.
What happens if the user refreshes after submitting?
Nothing — the request already went through. If you want to prevent the back-button from re-submitting, redirect to a /thanks page after success (using react-router or window.location).
How do I test the form locally?
Splitforms accepts requests from any origin during development if your access key has no domain restrictions. Add localhost to allowed domains for production-mode testing, or skip restrictions for the dev key.
Can I use this with React Server Components?
RSC can't have onSubmit handlers — they're server-rendered. Either use the server-action pattern (supported in Next.js / experimental in Remix) or wrap the form in a Client Component ("use client").
Show 8 more questions
useState + setStatus inside async causes race conditions
If a user double-clicks submit before the first request settles, you'll fire two POSTs. Always disable the button while status === 'loading'. Better still, also use an AbortController to cancel the in-flight request if a re-submit happens.
FormData and controlled inputs can desync
If you control inputs via useState (value={name} onChange={...}), the FormData object you build with new FormData(e.target) won't see your state — it reads the actual DOM. Either use uncontrolled inputs (no value prop) or build the body manually from state.
CSP errors when posting to a third-party endpoint
If your site has a strict Content Security Policy with connect-src 'self', fetch to splitforms.com will be blocked. Add splitforms.com to your connect-src directive: connect-src 'self' https://splitforms.com.
Strict mode + double-mount triggers two submissions in dev
React 18+ strict mode mounts components twice in development to surface side effects. If you put your fetch call in useEffect (don't), you'll see double-submits. Always trigger network calls in event handlers, not effects.
Don't forget to e.preventDefault() on the form's onSubmit
Without preventDefault, the browser does its own form submission to wherever the form's action attribute points (or the current page) AND your handler runs — you get an unexpected page reload + your fetch call.
Stale closures in event handlers freeze your access key on hot reload
If you read process.env.REACT_APP_SPLITFORMS_KEY (CRA) or import.meta.env.VITE_SPLITFORMS_KEY (Vite) inside a useCallback or memoized handler, rotating the key in .env and saving doesn't update the captured value during HMR — only a full page refresh does. The form keeps POSTing the old key for the rest of the dev session and silently 401s. Read env vars at the module top level, or accept the key as a prop so React's normal reactivity propagates the new value.
How does React handle forms without splitforms?
React itself ships nothing for form submission — it's a view layer. The historical baseline is one of: an Express/Hono/Fastify server you stand up just for POST /api/contact, a Function-as-a-Service (Vercel/Netlify/Cloudflare) that ends up needing the same SMTP wiring, or a third-party form library (React Hook Form, Formik) that handles validation but still leaves you to operate the backend. Vite, CRA, and Remix all default to assuming you have somewhere to POST — they just don't tell you where. Splitforms is the where: a single fetch call, no library install, no useEffect gymnastics, no Express boilerplate.
Any deployment notes for shipping React to production?
Vite-built React apps are static — they deploy to any static host (Vercel, Netlify, Cloudflare Pages, S3, GitHub Pages). The splitforms fetch is cross-origin, so configure your CSP to allow connect-src 'self' https://splitforms.com if you have one. Vite reads env vars from .env at build time and only exposes those prefixed VITE_ to the browser bundle. CRA uses REACT_APP_ instead. On Cloudflare Pages, the build output is served from the edge with sub-50ms cold starts; splitforms adds another ~30ms RTT — not noticeable in practice. Lock the access key to your live origin in the splitforms dashboard.
Simple pricing
Start free. Upgrade when you need more.
Ship your React contact form in 60 seconds.
Free to start on 500 submissions a month. Need Slack alerts, signed webhooks, or file uploads? Pro unlocks them for $5/mo — so you only pay once you outgrow free.
- No credit card required
- 500 free submissions
- Setup in minutes

