Contact Form

  • + 1 comment
    const handleSubmit = (e) => {
    e.preventDefault(); 
    
    if ( !name || !email || !message ){
    
            setError( 'All fields are required.' );
            setSubmittedData('');
    
    } else {
    

    // 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

    setError('');
    setSubmittedData({ name, email, message });
    setName('');
    setEmail('');
    setMessage('');
    }
    

    };