1️⃣ Simple Method: Formspree (No Backend)
import React, { useState } from "react";
function Contact() {
const [status, setStatus] = useState("");
const handleSubmit = async (event) => {
event.preventDefault();
const formData = new FormData(event.target);
const response = await fetch("https://formspree.io/f/YOUR_FORM_ID", {
method: "POST",
body: formData,
headers: { Accept: "application/json" },
});
if (response.ok) {
setStatus("Thanks for your message!");
event.target.reset(); // Clear form after successful submission
} else {
setStatus("Oops! Something went wrong.");
}
};
return (
{/* Contact Info */}
Contact
Looking forward to hearing from you
- Phone
- 98575545525
- Email
- info@gmail.com
{/* Contact Form */}
);
}
export default Contact;
No comments:
Post a Comment