Using Zod Form Validation and Server Actions in NextJs with useFormState Hook

  Рет қаралды 3,449

Coding After Thirty

Coding After Thirty

Күн бұрын

Пікірлер: 18
@adomakins
@adomakins 3 ай бұрын
Thank you for the video! Forms feel so complicated and you broke it down super simply which was awesome
@CodingAfterThirty
@CodingAfterThirty 3 ай бұрын
Thank you. Glad you enjoyed it. 😀
23 сағат бұрын
Thank you very much
@CodingAfterThirty
@CodingAfterThirty 17 сағат бұрын
Thank you.
@noobboiii007
@noobboiii007 4 ай бұрын
Hey I have question can we deploy Strapi cms in Hostinger VPS server?
@CodingAfterThirty
@CodingAfterThirty 4 ай бұрын
I haven't used Hostinger, but any service that allows you to spin up a VPS would support Strapi deployment.
@adamovicslobodan3331
@adamovicslobodan3331 3 ай бұрын
I have an issue when I disable JS in the browser. I call the action, it is handled inside the server function, and when I send data to the Strapi, once I refresh the page ( still JS is disabled ), it again sends the data to the Strapi. How to prevent sending same formData again and again to the Strapi from the server-side?
@CodingAfterThirty
@CodingAfterThirty 3 ай бұрын
I will have to check it out and see. I did not test it with JS disabled. Are you expecting others to disable JS on your project? I am assuming it may have something to do with useFormState.
@adamovicslobodan3331
@adamovicslobodan3331 3 ай бұрын
@@CodingAfterThirty This was for my testing purpose...beacuse I saw on some video that the guy tested also server actions while JS i disabled.
@CodingAfterThirty
@CodingAfterThirty 3 ай бұрын
@@adamovicslobodan3331 hey can you link to one of the videos, I am curious if they were using useFormState. I want to explore the topic a bit more.
@MaximeOnDev
@MaximeOnDev 3 ай бұрын
Hey, nice video! But wouldn’t it be better to have both client-side and server-side validation? Right now, when a field is empty and you submit, we have to wait for the server response to get the error and make a useless POST request. If we also implement the Zod check on the client side, we would get the error immediately without waiting for the server response
@CodingAfterThirty
@CodingAfterThirty 3 ай бұрын
Yeah, you can do that, too. I made a video on client-side validation in the past, but in this video, I wanted to focus on server action and show that you can do validation on the server. But in a real-world project, you can use a combination of both strategies. Although I don't mind just server-side validation.
@MaximeOnDev
@MaximeOnDev 3 ай бұрын
@@CodingAfterThirtyi love how clean the server action look like. And it broke my heart to switch from action to a onSubmit 😭
@CodingAfterThirty
@CodingAfterThirty 3 ай бұрын
@@MaximeOnDev Lol, I try to avoid any extra useState or useEffects in my projects. I almost want to do every action as a form and use server actions. But for better user UI experience sometimes you have no choice.
@kennethlau8108
@kennethlau8108 3 ай бұрын
Can we have a github link for this ? Perhaps an example code that reflects this. Thanks
@CodingAfterThirty
@CodingAfterThirty 2 ай бұрын
Sorry it took me a bit to reply, but here is the repo for the project. github.com/PaulBratslavsky/strapi-5-next-15-store
@mystupidbrain5299
@mystupidbrain5299 4 ай бұрын
First
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
This is why useFormState and useFormStatus are important
8:46
Web Dev Cody
Рет қаралды 20 М.
React Hook Form (+ Zod) - Complete Tutorial
31:21
ByteGrad
Рет қаралды 111 М.
Are we going back to PHP with fullstack JavaScript?
9:57
Maximilian Schwarzmüller
Рет қаралды 162 М.
Using React Hook Form, Zod Validation and Server Actions in NextJs
25:55
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН