DEV Community

Vicente G. Reyes
Vicente G. Reyes

Posted on

How do you do validations with ReactJs forms?

I've been receiving spammy, real-user submitted form submissions on my site https://studio.icvn.tech/#contact. As a new dev who's been learning react, I find it hard to block free emails on my form.

Does anyone know a solution?

Code is at https://github.com/icvntechstudio/rebrand/blob/master/src/components/Contact.js

Thanks!

Top comments (5)

Collapse
 
cuginoale profile image
Alessio Carnevale • Edited

Old question but it can help others.
I explore a very easy and effective approach to form validation here:
dev.to/cuginoale/form-validationsu...

Your feedback would be really welcome!

Collapse
 
faks profile image
Oskars Germovs

Could integrate some validation library and validate the form.

Collapse
 
highcenburg profile image
Vicente G. Reyes

Any suggestions on a validation library?

Collapse
 
faks profile image
Oskars Germovs • Edited

Hi, Vincente, the first that comes to mind is validate.js, then maybe React Hook Form, there are more but currently can't remember them :).
dev.to/narendersaini32/top-react-f...

Collapse
 
highcenburg profile image
Vicente G. Reyes

Hi Erick, thanks for answering. The bots are already stopped by hcaptcha. What I'm trying to do is to stop free emails from being submitted to the form.