A React contact form component that submits to FormHandle via fetch().
npm create vite@latest my-app -- --template react
cd my-app
npm install
npx formhandle initCopy ContactForm.jsx into your src/ directory and import it.
import ContactForm from './ContactForm'
function App() {
return (
<div>
<h1>My Site</h1>
<ContactForm handlerId="YOUR_HANDLER_ID" />
</div>
)
}Replace YOUR_HANDLER_ID with your actual handler ID, or read it from an environment variable:
<ContactForm handlerId={import.meta.env.VITE_FORMHANDLE_ID} /># .env
VITE_FORMHANDLE_ID=abc123