import React from 'react'; export function Email() { const [email, setEmail] = React.useState(''); const [emailLoading, setEmailLoading] = React.useState(false); const [emailError, setEmailError] = React.useState(); const [emailSuccess, setEmailSuccess] = React.useState(); function handleEmailSubmit(e) { e.preventDefault(); if (!email) { return; } setEmailError(false); setEmailSuccess(false); setEmailLoading(true); fetch('/api/email', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ email, }), }) .then((res) => res.json()) .then((data) => { setEmailLoading(false); setEmailSuccess(true); }) .catch(() => { setEmailLoading(false); setEmailSuccess(false); setEmailError(true); }); } return (

Stay Informed

We will keep you up to date with the latest on this case.
setEmail(e.target.value)} />
{emailSuccess && (
Thank you! We will keep you in the loop.
)} {emailError && (
Sorry, there was an error. Please try again.
)}
); }