1import React from 'react';
2import emailjs from 'emailjs-com';
3
4import './ContactUs.css';
5
6export default function ContactUs() {
7
8 function sendEmail(e) {
9 e.preventDefault();
10
11 emailjs.sendForm('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', e.target, 'YOUR_USER_ID')
12 .then((result) => {
13 console.log(result.text);
14 }, (error) => {
15 console.log(error.text);
16 });
17 }
18
19 return (
20 <form className="contact-form" onSubmit={sendEmail}>
21 <input type="hidden" name="contact_number" />
22 <label>Name</label>
23 <input type="text" name="user_name" />
24 <label>Email</label>
25 <input type="email" name="user_email" />
26 <label>Message</label>
27 <textarea name="message" />
28 <input type="submit" value="Send" />
29 </form>
30 );
31}
32