import indexStyles from '../styles/index.module.css' import React from 'react'; import ReCAPTCHA from "react-google-recaptcha"; export default function ContactForm() { const recaptchaRef = React.createRef(); const sendMessage = async event => { event.preventDefault() var payload = JSON.stringify({ g_recaptcha_response: recaptchaRef.current.getValue(), sender_email: event.target.sender_email.value, message: event.target.message.value }) const res = await fetch('/contact', { body: payload, headers: {'Content-type': 'application/json'}, method: 'POST' }) const result = await res.json() event.target.parent().append("
" + result.message + "
")
event.target.remove()
}
return (
Contact Me