import { useMutation } from "blitz"; import { useForm } from "react-hook-form"; import joinWaitlist from "../mutations/join-waitlist"; type Form = { email: string; }; export default function CTAForm() { const [joinWaitlistMutation] = useMutation(joinWaitlist); const { handleSubmit, register, formState: { isSubmitted }, } = useForm
(); const onSubmit = handleSubmit(async ({ email }) => { if (isSubmitted) { return; } return joinWaitlistMutation({ email }); }); return ( {isSubmitted ? (

You're on the list! We will be in touch soon

) : (
)}
); }