Kirimase - Validated forms & Error Handling with Next.js

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I also mentioned in the demo how you will have error handling and z validators uh ready to go right out of the box I just want to show you a quick demo of what I actually mean by that so if we head to the terminal quickly jump into the project and go over to the books action this is the server action that powers the creation of the books we head down here and let's just throw an error here um in the create book action if we try and create a book now Test new book uh and we create you'll see we have our error here this also if this was being handed by the database you could see like DB error FK FKA problem I don't know uh and we try and do that again and you'll see that that error is handled handed directly to the user and again it just works it works across um the whole application everything that's generated now let's say um let's say let's go back to the authors and show off um some validations let's say we want to go go to uh the schema of the books uh we're going to head down into the insert book pams uh Zod schema which is for uh the front end form validation let's say completed well actually let's do um title and say that title has to be a z. string with minimum of three four characters and say uh a message of you need at least four characters for the title and add a comma don't forget that now if we were to try and make a new book and we hit enter look at that like the validation already there you've got the create is blocked so you cannot create a new thing and your message is passed directly to the form it just it just works so yeah
Info
Channel: Nico Albanese
Views: 566
Rating: undefined out of 5
Keywords:
Id: H0433TkLjLs
Channel Id: undefined
Length: 1min 51sec (111 seconds)
Published: Tue Feb 06 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.