#Handle form on client side

1 messages · Page 1 of 1 (latest)

granite badger
#

Hi there! I have route, React component and form inside. I want to handle form submit on client side

This is how I add handler <form onSubmit={handleSubmit}>
This is my handler ```js
function handleSubmit(e) {
e.preventDefault();
console.log("This is submit");
}


And finally I can't see my console.log, I instantly go to action, which handles my request on server side. 
The question is - how to handle form submission on client side without reload?

Thanks in Advance
proud oar
#

Looks correct, any additional code to share?

faint dagger
#

remix Form component doesn't do navigation unless u tell it to, unless js has not loaded yet.

#

u can use use fetcher