Zod is a schema validator, it means you give your object to it and it checks that if it is exactly the same as the interface that you defined or not, and if it isn't, it gives you an error!
What does it mean? It means that you don't need to use if-elses
anymore like before, e.g.
if(name=== null || name==="")
...
if(name.length>5 && name.length<10)
...
if(number && number !==0 || number >0 ...)
It does all this by itself only with the following command:
z.safeParse(formdata);
more examples:
Introduction ~7min 👌
To get to know it better, watch this video from WebDevelopSimplified:
Learn it completely ~30 min 🤩✨
To learn it completely, and use it to save alot of time from yourself and also shipping reliable code watch this video
Top comments (0)