DEV Community

Cover image for Top 5 form validation libraries in React JS and Next JS

Top 5 form validation libraries in React JS and Next JS

ZeeshanMustfai on September 30, 2023

Formik is a widely used library for building forms in React, next, and Vuejs as well. It includes a built-in form validation system that is easy ...
Collapse
 
jimivi8846 profile image
Jimivi

Well, as of October 2023 Formik is deprecated because it is no longer maintained, you can find the link to the GitHub comment by the maintainers where it is suggested to use React Hook Form

Link for reference

Collapse
 
zeeshanmustfai profile image
ZeeshanMustfai • Edited

Jimivi I don't think so
because formik is the most popular form validation in the latest web apps.
Check out the last update 13 days ago.

Image description

Collapse
 
shifi profile image
Shifa Ur Rehman

React hook form all the way baby!

Collapse
 
ankur131198 profile image
ANKUR SHARMA

There is very simple way to validate emails with Yup like you only write Yup.email().required (). Now, you can't write the complex regex for the validation of the emails

Collapse
 
zeeshanmustfai profile image
ZeeshanMustfai

We can also write your own regex for complex email validation. for example
Yup.string()
.required("Email is required")
.matches(
/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/,
"Invalid email format"
)

Collapse
 
ankur131198 profile image
ANKUR SHARMA

Yes