Contact Form

  • + 0 comments

    there is a full stop at the end of sentence that cuased my code to fail.

    const all_req = "All fields are required.";
    
      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
        if (name.trim() === "" ||  email === "" ||  message === ""){
          setError(all_req)
    
        }
         setSubmittedData({ name, email, message });
         setName("");
         setEmail("");
         setMessage("");
      };