Nextjs Server Actions Just Got Better

  Рет қаралды 10,846

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 47
@풍월상신
@풍월상신 5 ай бұрын
I hope you get well soon. Feel free to skip a week or two.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Thanks for the kind words!
@codezero6023
@codezero6023 5 ай бұрын
I hope you are feeling better, Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Getting there!
@bilimlink
@bilimlink 5 ай бұрын
Thank you for your time and efforts that poured into the video. Stay healthy
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You're welcome!
@FalioV
@FalioV 5 ай бұрын
No matter of the topic, I always have something to stay with you untill the end of the video. Great content as always! :)
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Thank you!
@oladapooluwadurotimi2865
@oladapooluwadurotimi2865 5 ай бұрын
❤. Your voice sounds different today boss. Edited: get well soon sir.and be safe out there.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Yes I've been sick. Hope to be back to normal by next week
@oladapooluwadurotimi2865
@oladapooluwadurotimi2865 5 ай бұрын
@@DaveGrayTeachesCode that's great to hear sir. Stay strong and jiggy sir. Wishing a quick recovery 🙏😊.
4 ай бұрын
Thanks Dave, this package helped me a lot, I would like to know how we can implement this for file type Inputs?
@zlackbiro
@zlackbiro 5 ай бұрын
They just going mad out there. There is a library to fix the library in js to fix next... What the fuck is wrong with those guys!? Who can follow everything about new changes everyday!!!
@allone258
@allone258 5 ай бұрын
no problem, our emotions change every day
@abdulkarim018
@abdulkarim018 5 ай бұрын
Hope you get well soon. Your voice sounded different since the beginning of the video
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Several days of coughing and congestion will do that. Getting better.
@larryblanchette3554
@larryblanchette3554 4 ай бұрын
Been trying to do some unit tests on my server actions that use next, next-safe-actions and jest. No bueno for me. I’m kinda new at this …
@johnaroj
@johnaroj 5 ай бұрын
this is looking to go a bit like the trpc way of doing things
@ZaibGsm
@ZaibGsm 5 ай бұрын
Dave I have a question I am having more than 2 years of exp but still I need to watch video before implementation anything new like useActionState new hook
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Nothing wrong with that. I read docs, blogs and watch videos, too.
@ZaibGsm
@ZaibGsm 5 ай бұрын
@@DaveGrayTeachesCode oh thanks Dave 💝
@shaked1233
@shaked1233 5 ай бұрын
Is there any benefits over tanstack query? If im not mistaken everything you showed is possible through use query
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I need to check the latest on that. It is possible that TanStack is also handling server actions now. I should add the main emphasis here is the integration of Zod (or other validation if you want) so you don't have to handle all of that as I showed in the refactor. Last I checked, TanStack didn't directly integrate the validation step as shown here.
@BliitzPint
@BliitzPint 5 ай бұрын
Doesn't "useActionState" from React do exactly that? Why a third party hook?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Not the same. I should have emphasized the differences more. This implements Zod or other validation and abstracts away catching errors - no try/catch necessary. Also provides clearly defined error types. I'm going to do a follow up using toasts to show some additional patterns.
@Grishopping
@Grishopping 5 ай бұрын
Greetings friend thanks for the video.... Answering your question... What do you want to see in the following videos (12:50) Explanation of turborepo adding tailwind and schadcn/ui and if you can also add PRISMA or Drizzle with that we hit a home run. Greetings Jose Grillo from Venezuela
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Thank you for the suggestions Jose!
@aymenbachiri-yh2hd
@aymenbachiri-yh2hd 5 ай бұрын
Thank you so much
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You're most welcome!
@dileepa-mn2to
@dileepa-mn2to 5 ай бұрын
Hi Dave, Im a newbie. can you exaplin why we use server actions if we are using a external API, is it make a difference with react-query and this server actions
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
An external API might take a different approach. If I'm just fetching data and not mutating it, I would fetch directly from a server component if possible.
@dileepa-mn2to
@dileepa-mn2to 5 ай бұрын
@@DaveGrayTeachesCode If we are fetching from a server component, this approach is better. am I correct?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
@@dileepa-mn2to that is preferable when possible.
@olehmeserenko
@olehmeserenko 5 ай бұрын
Any benefits over tanstack query? I am using server actions with useMutation from tanstack query right now, which has everything you need under the hood (error handling, loading states, etc.)
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
I think the emphasis here is on validation. This integrates well with zod or other validation libraries like valibot. I need to check the latest but last time I used React query, it wasn't handling all of this under the hood.
@olehmeserenko
@olehmeserenko 5 ай бұрын
@@DaveGrayTeachesCode Got it. Definitely recommend checking it out. Hope to see the video from you!
@nico-y9i
@nico-y9i 5 ай бұрын
Hi Dave! I've been stuck on the trouble of having to display server error to client side. I just recently learned that in production, the server would change the error that was returned to client to a generic error message(I think this is not the issue when using action and useFormState instead of onSubmit). Should I use this on every form that uses react-hook-form and server actions? In a real world scenario, is it enough to just display a generic error message from the server? Whenever I want to do a mutation, I'm thinking of using the native form action before I switch to react-hook-form if my form is complex. Is this the right approach? Lastly, base from your experience, does it matter for UX if the error message is displayed when the form is submitted or on input blur/change.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
There should be no problems displaying an error client side using what I show in this tutorial. I am going to do a follow-up to this with a toast message tutorial. There are several patterns that can be used. It won't just display a generic server message. As shown, you also get validation errors and fetch errors. You can modify the server error to show e.message so it can be very specific. I suggest sticking with react-hook-form and showing errors onBlur. It is a much preferred user experience.
@KkrDs97
@KkrDs97 5 ай бұрын
same here, I am not able to get the error on to the client side, we can throw the generic error but returning an specific error is not working
@MarosiMate-sq2wm
@MarosiMate-sq2wm 2 ай бұрын
@@KkrDs97 Why would you do that? If you are using React Hook Form on the client side, you are already displaying errors to the user.
@rifatmunna
@rifatmunna 5 ай бұрын
at this point i'm disappointed now can make a full e-comm website with payment and everything also learn new tech from document. thanks to you . but the sad part is i did't earn a penny even now. Maybe i miss the part where you tech how to land or get hired or earn from web dev
@MohamedElguarir
@MohamedElguarir 5 ай бұрын
that's what happens if you're in this field just for the money, instead of passion.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
Some channels focus on jobs, interviews, etc. I just focus on skills. The rest will happen if you develop skills. My top advice for getting a job is networking though. Make connections in the industry.
@mertdr
@mertdr 5 ай бұрын
You can’t even imagine how huge the difference between tutorials and real world projects. I know it might be difficult to get hired but nowadays one’s priority shouldn’t be earning money. Minimum wage or even for free, it doesn’t matter. Just start working in a company where you can learn to overcome real world obstacles.
@njosuedev.
@njosuedev. 5 ай бұрын
thank you so much
@DaveGrayTeachesCode
@DaveGrayTeachesCode 5 ай бұрын
You're welcome!
The Problem with React Server Actions
9:45
Josh tried coding
Рет қаралды 22 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 7 МЛН
Yay😃 Let's make a Cute Handbag for me 👜 #diycrafts #shorts
00:33
LearnToon - Learn & Play
Рет қаралды 117 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 18 МЛН
Don't Make These Next.js Mistakes
13:01
Dave Gray
Рет қаралды 23 М.
When to use server actions in Next JS 14
5:28
WebDevEducation
Рет қаралды 10 М.
NextJS Parallel Routes Explained with a Simple Example
14:04
Dave Gray
Рет қаралды 15 М.
Next.js Will Never Be The Same After This
36:12
ByteGrad
Рет қаралды 29 М.
My Problem with Next.js Server Actions
10:13
James Q Quick
Рет қаралды 18 М.
Next 14 + React Query COMBO with Server Actions and RSC
9:49
developedbyed
Рет қаралды 116 М.
Next.js 15 Ruins Caching Even More
13:56
Web Dev Simplified
Рет қаралды 49 М.
Turning bad React code into senior React code
13:10
Cosden Solutions
Рет қаралды 93 М.
The 3 REAL benefits of Next.js Server Actions
12:11
ByteGrad
Рет қаралды 30 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 7 МЛН