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

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ • 29

  • @meka4996
    @meka4996 Рік тому +8

    This is so amazing!!! This is much easier than React Hook Form + Zod! Thanks

    • @mukulsinghbisht2434
      @mukulsinghbisht2434 7 місяців тому +2

      React hook form has its own advantages

    • @_ilearn
      @_ilearn 29 днів тому

      Easier, but not better.

    • @meka4996
      @meka4996 29 днів тому

      @@_ilearn If it is easier, then it is better.

  • @snivels
    @snivels Рік тому +3

    Exceptionally well explained. Great video!

  • @codiwebcat
    @codiwebcat Рік тому +1

    Fantastic video and all your content!

  • @hamzamellahi120
    @hamzamellahi120 Рік тому +2

    love your videos, please make more!

  • @psyferinc.3573
    @psyferinc.3573 Рік тому +1

    thanks
    looking for a zod tutorial now

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd 4 місяці тому

    very clean explanation, thank you somuch

  • @wingy3181
    @wingy3181 Рік тому +1

    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....

  • @yoyo26-34
    @yoyo26-34 10 місяців тому +1

    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.

  • @ajlmusic
    @ajlmusic 10 місяців тому +1

    Excellent!

  • @Sachin-ci1cs
    @Sachin-ci1cs 25 днів тому

    love you bro!!

  • @MuhamadAzizPrasetyo
    @MuhamadAzizPrasetyo 5 місяців тому +1

    Thank you ☺☺

  • @writterpanditsid5048
    @writterpanditsid5048 10 місяців тому +1

    Thanks

  • @lrnngman2942
    @lrnngman2942 Рік тому

    Can I use React hook form with Zod?
    or should using only 1way?

  • @BuryneJoel
    @BuryneJoel Рік тому +1

    Thank you sir

  • @eSeMGie
    @eSeMGie 7 місяців тому

    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 6 місяців тому +2

      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 6 місяців тому

      @@WebDevNiko Big thanks for clarification!

    • @eSeMGie
      @eSeMGie 6 місяців тому

      @@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 6 місяців тому +1

      @@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

  • @janyumi1995
    @janyumi1995 4 місяці тому +1

    cool

  • @swdotdev
    @swdotdev 9 місяців тому

    Well the only problem with zod is that it makes large scale apps significantly slower. Other than that, yea it is great for sure.

  • @GabrielLogan17
    @GabrielLogan17 6 місяців тому

    Try my library too, multiform-validator

  • @easy_frontend
    @easy_frontend 2 місяці тому

    if you could please would you share the code

  • @Hicham-z7t
    @Hicham-z7t Рік тому +1

    you got great videos, but it is so hard to follow you as you speak too fast. thx

    • @celsopires1999
      @celsopires1999 Рік тому +1

      you can reduce the video speed if it too fast for you

    • @sskular
      @sskular Рік тому +3

      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