DEV Community

Discussion on: How to add a Netlify Contact Form in React

Collapse
 
mcshazz profile image
CMcSharry • Edited

How would I get this to work when the form is on my homepage? The form submits but the page reloads and takes the viewport back up to the top of the page. I've tried putting the whole url before the "?success=true" and i've tried with just the / before it, but neither way works.

I've tried using preventDefault but then the form just doesn't get sent.

I wonder is it something to do with the # getting added at the end of my urls?

Collapse
 
singhshashank profile image
Shashank Singh

No, all you've to do is make it action="/success=true". Hope it helps. :)