Contact Form

  • + 0 comments
      const handleSubmit = (e) => {
        e.preventDefault();
        // TODO: Add logic to validate inputs and display submitted data
        // HINT: You can use the setError function
    
        // HINT: You can use the setSubmittedData function as below
        // setSubmittedData({ name, email, message });    
        if (!name || !email || !message) {
          setError("All fields are required.");
        } else {
          setSubmittedData({ name, email, message });
          setName("");
          setEmail("");
          setMessage("");
          setError(""); // Clear any existing error
        }
      };``