Validate Data With Zod in Server Actions Next.js (Client-Side + Server-Side)

  Рет қаралды 19,083

ByteGrad

ByteGrad

10 ай бұрын

👉 NEW React & Next.js Course: bytegrad.com/courses/professi...
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
👉 Add authentication to your app FAST: bit.ly/3QOe1Bh
👉 NEW React & Next.js Course: bytegrad.com/courses/professi...
👉 Professional JavaScript Course: bytegrad.com/courses/professi...
👉 Professional CSS Course: bytegrad.com/courses/professi...
👉 Discord: all my courses have a private Discord where I actively participate
🔔 Email newsletter (BIG update soon): email.bytegrad.com
⏱️ Timestamps:
0:00 Solution
#webdevelopment #programming #coding

Пікірлер: 23
@meka4996
@meka4996 8 ай бұрын
This is so amazing!!! This is much easier than React Hook Form + Zod! Thanks
@mukulsinghbisht2434
@mukulsinghbisht2434 2 ай бұрын
React hook form has its own advantages
@MuhamadAzizPrasetyo
@MuhamadAzizPrasetyo 5 сағат бұрын
Thank you ☺☺
@snivels
@snivels 10 ай бұрын
Exceptionally well explained. Great video!
@hamzamellahi120
@hamzamellahi120 8 ай бұрын
love your videos, please make more!
@psyferinc.3573
@psyferinc.3573 8 ай бұрын
thanks looking for a zod tutorial now
@codiwebcat
@codiwebcat 6 ай бұрын
Fantastic video and all your content!
@wingy3181
@wingy3181 8 ай бұрын
Question: do you think the revalidation of the mutated data should be decoupled from the server action? that is, i notice that revalidatePath("/todos") is inside the server action....which means it couples the path to the server action....
@ajlmusic
@ajlmusic 5 ай бұрын
Excellent!
@BuryneJoel
@BuryneJoel 10 ай бұрын
Thank you sir
@writterpanditsid5048
@writterpanditsid5048 4 ай бұрын
Thanks
@lrnngman2942
@lrnngman2942 8 ай бұрын
Can I use React hook form with Zod? or should using only 1way?
@jeromealtariba7339
@jeromealtariba7339 5 ай бұрын
Hi, this is a nice video, however, when using actions (on not the onSubmit prop of the form), the client side validation is not triggerring at all. Only the server side validation is displayed.
@user-xp6gm2bz8w
@user-xp6gm2bz8w 10 күн бұрын
Try my library too, multiform-validator
@eSeMGie
@eSeMGie Ай бұрын
Great wideo! That's exactly what I was looking for. I have a question though. Why do we need validation on the client and server side? It seems to be redundant. Is any possible way to pass validation one the client side and fail validation one the server side? We actually passed already validated data to the server.
@WebDevNiko
@WebDevNiko Ай бұрын
client side validation is used to give normal user feedback if validation fails but you want also server side validation before pushing the data to database etc since client side isnt to be trusted as its easyer to modify and pass the validation if you would want to do that
@eSeMGie
@eSeMGie Ай бұрын
@@WebDevNiko Big thanks for clarification!
@eSeMGie
@eSeMGie Ай бұрын
@@WebDevNiko I wonder, why we can't just make a validation on the server side, and then if validation failed return all error messages to client and give the user feedback?
@WebDevNiko
@WebDevNiko Ай бұрын
@@eSeMGie you could do that but having extra validation on client side prevents sending unnecessary requests to server side, eg every time user forget to type last name you wont send request to server. Basically its just more efficent to have validation both on client and server side especially with zod since u can reuse the schema easyly so its effortless
@swdotdev
@swdotdev 3 ай бұрын
Well the only problem with zod is that it makes large scale apps significantly slower. Other than that, yea it is great for sure.
@user-xq2pi3bu4y
@user-xq2pi3bu4y 8 ай бұрын
you got great videos, but it is so hard to follow you as you speak too fast. thx
@celsopires1999
@celsopires1999 8 ай бұрын
you can reduce the video speed if it too fast for you
@sskular
@sskular 7 ай бұрын
I actually love how snappy it is, to the point You can reduce speed and I sometimes rewind and/or pause when I feel I need a better look at a particular part of the video
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53
Which one is the best? #katebrush #shorts
00:12
Kate Brush
Рет қаралды 19 МЛН
Как быстро замутить ЭлектроСамокат
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 13 МЛН
NextJS 14 - How to Submit FORM DATA using UseFormState
23:48
Codr Kai
Рет қаралды 2,6 М.
React Hook Form (+ Zod) - Complete Tutorial
31:21
ByteGrad
Рет қаралды 81 М.
Fetching Data Doesn't Get Better Than This
6:58
Josh tried coding
Рет қаралды 75 М.
Zod Makes TypeScript Even Better
7:14
Web Dev Simplified
Рет қаралды 151 М.
The BEST way to host Next.js websites
17:37
ByteGrad
Рет қаралды 22 М.
Next.js Server Actions...  5 awesome things you can do
7:51
Beyond Fireship
Рет қаралды 252 М.
My Problem with Next.js Server Actions
10:13
James Q Quick
Рет қаралды 15 М.
Next JS Form Validation Using Server Actions
19:41
Full Stack Niraj
Рет қаралды 1,3 М.
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53