I am using React.js and I can’t seem to get netlify to acknowledge my form for some reason…
Here is my code:
function Contact(){
const [success, setSuccess] = useState(false);
useEffect(() => {
if (window.location.search.includes('success=true')) {
setSuccess(true);
}
}, []);
return (
<div className='contact'>
<div className='contact__left'>
<form name='contact' className='contact__form' method='POST' action="/contact/?success=true" data-netlify='true' >
<div className='contact__container'>
<input type="hidden" name="form-name" value="contact" />
<input className='contact__input' type='text' name='name' placeholder={`What's your name?`} required></input>
<input className='contact__input' type='email' name='email' placeholder='Email?' required></input>
<textarea className='contact__details' type='text' name='message' placeholder='Details...' required></textarea>
<button className='contact__button' name='submit'>Let's do it!</button>
</div>
</form>
</div>
<div className='contact__right'>
<h1 className='contact__call'>
Let's Get Started!
</h1>
</div>
</div>
)
}
export default Contact;
I’ve also added this to the index.html as per some forum post I saw but have since lost…
<form name="contact" netlify netlify-honeypot="bot-field" action='/' hidden>
<input type="text" name="name" />
<input type="email" name="email" />
<textarea name="message"></textarea>
</form>