The 3 REAL benefits of Next.js Server Actions

  Рет қаралды 24,114

ByteGrad

ByteGrad

Күн бұрын

👉 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 Old way
2:04 New way
3:08 API route
4:10 First benefit: Server Action
6:00 Under the hood
6:57 Second benefit: useFormStatus & useOptimistic
9:44 Third benefit: Progressive enhancement
#webdevelopment #programming #coding

Пікірлер: 49
@ByteGrad
@ByteGrad 18 күн бұрын
My Professional React & Next.js course is OUT NOW now! Find it here: bytegrad.com/courses/professional-react-nextjs -- this is the #1 resource to master the latest React & Next.js, my absolute best work.
@TheGrandChieftain
@TheGrandChieftain 9 ай бұрын
Server actions might make the actual request simpler, but React Query seems a lot better for managing the state of your fetch requests.
@dopetag
@dopetag 9 ай бұрын
This is the second video I have watched on this channel and I am already in love. The explanations are really clear and on point. Top level content!
@ByteGrad
@ByteGrad 9 ай бұрын
Awesome, thank you!
@psyferinc.3573
@psyferinc.3573 8 ай бұрын
your doing well man. im glad you joined the scene
@JasonWongFing
@JasonWongFing 7 ай бұрын
Thanks for your video and explanation! It's helpful to me!
@user-pf1uk8py3r
@user-pf1uk8py3r 4 ай бұрын
Thanks for your clear explanation! ❤
@spas.z.spasov
@spas.z.spasov 6 ай бұрын
Hello, thank you for the tutorials. What I'm searching for for complex form validation - i.e. a tutorial that puts together the 1) server actions + 2) react-hook-form + 3) zod.
@martg0
@martg0 4 ай бұрын
very interesting! clear explanation 👏 Would this apply for a datagrid too?
@matthiasmatanda4295
@matthiasmatanda4295 4 ай бұрын
Thank you sir for this short video with very important information that I needed to hear.
@ianc6418
@ianc6418 6 ай бұрын
another great class. thank you
@cengizturk
@cengizturk 10 ай бұрын
This is exactly what I was looking for. Thanks.
@NeilGebhard
@NeilGebhard 9 ай бұрын
Appreciate the way you explain things
@AnkitSharma-mu3oj
@AnkitSharma-mu3oj 9 ай бұрын
In previous video you told importing something inside "use client" component then whatever is imported also runs on client side ?
@dawid_dahl
@dawid_dahl 6 ай бұрын
Subscribed to this channel so hard! 👌🏻
@phsopher
@phsopher 10 ай бұрын
Helpful explanation thanks! Does this only work for forms? Suppose I just want to have a single button that does something, e.g., liking a comment on a social media site. Should I go through the whole process of wrapping it in a form, then making the button a separate child component etc. Seems easier to just make an api endpoint and call it on onClick. Or is there a more Nextonic (a word I just made up) way?
@ByteGrad
@ByteGrad 10 ай бұрын
Yes, works outside forms too but you have to invoke the server action differently (not with ‘action’ attribute)
@appstuff6565
@appstuff6565 6 ай бұрын
can we use server actions for sign in , currently using action='/auth/sign-in' with method = 'post' where my sign-in route.ts in in app/auth/sign-in/route.ts?
@alvaro1728
@alvaro1728 6 ай бұрын
So on the surface it may seem simpler but in practice it still makes the same number of network trips and now you have to deal with NextJS and having client vs server components. BTW, you can easily abstract away the fetch calls inside utility classes (eg, api.todos.add(value)). It's a nice way to separate the concerns.
@hibachouchene
@hibachouchene Ай бұрын
Best explanation on KZfaq 🤩
@baliramgiri2877
@baliramgiri2877 5 ай бұрын
what if we have server in node and from there, we are storing cookies to browser and using in server components, so I am not possible get access of cookies to node server. is there any way?
@boyywnkobe
@boyywnkobe 9 ай бұрын
is it work only for app folder ?
@saidibra9231
@saidibra9231 9 ай бұрын
can you please make a video between Next.js and Express.js and which one to choose in the back-end and the benefits and cons of each one
@ByteGrad
@ByteGrad 9 ай бұрын
Good idea
@berndeveloper
@berndeveloper 7 ай бұрын
Nextjs has a decent backend, but between Express and Nextjs for backend, I prefer "Nestjs". This last one is a JS backend framework that uses express but is opinionated, I recommend it with close eyes.
@gubocci
@gubocci 6 ай бұрын
Having used nestjs for one medium large project - would not recommend. Way overkill for most projects and makes some simple things way too labour intensive.
@jorden123
@jorden123 10 ай бұрын
Thanks for your video and explanation! From a DevOps perspective... you are creating a monolith application, which you can not scale the front and the back separately, I guess this is the biggest downside. The other big downside is that you can not use multiple clients (front-ends) and using the same server (back-end).
@rjlacanlaled9419
@rjlacanlaled9419 8 ай бұрын
turborepo? you create reusable components for each client (assuming they all use typescript/javascript)
@Thikondrius
@Thikondrius 6 ай бұрын
Yeah that is what I am not a fan of server action. There are made to be used by your nextjs front ONLY.
@alexnelson2119
@alexnelson2119 5 ай бұрын
I've really been enjoying server actions. Nice not to have to make an api route. One thing I found out recently that's a bit annoying with respect to form data is there are no actual boolean type values you can get from HTML forms. Checkboxes only have 'on' when checked and no value at all if unchecked. Also, input forms always have string values when you get their value from formData, never a number, even if the input is type=number. Of course you can always do a combo of state and server actions.
@yigitardaunsal7269
@yigitardaunsal7269 10 ай бұрын
what is the name of vs code theme?
@mahdimotallebi7207
@mahdimotallebi7207 8 ай бұрын
Thank you
@coders_rant
@coders_rant 10 ай бұрын
Good explanation
@SR-zi1pw
@SR-zi1pw 10 ай бұрын
Nice comparison
@learner8084
@learner8084 Ай бұрын
I'm confused. Do I use React Hook Forms or use Server Actions ? Does React Hook Forms also use server action ? If I use React Hook Forms, I give up the benefit of server actions ? Any advice any one ? Thanks very much in advanced.
@brancode404
@brancode404 9 ай бұрын
When are you releasing you Next Js course?
@ByteGrad
@ByteGrad 9 ай бұрын
It’s super close. Make sure you’re subscribed to the email newsletter :)
@mekelilyasa9561
@mekelilyasa9561 2 ай бұрын
what's the diffirent with php
@stevebendersky2056
@stevebendersky2056 9 ай бұрын
How do you reset the form without using useState for each input field?
@MrBrandenS
@MrBrandenS 9 ай бұрын
Well if you need the whole form reset, html forms have a reset method for wiping out inputs.
@stevebendersky2056
@stevebendersky2056 10 ай бұрын
Thanks, how do I do it with dashboard and get data? outside of forms
@ByteGrad
@ByteGrad 10 ай бұрын
Best to use fetch in a server component to get data
@devarshihazarika4871
@devarshihazarika4871 10 ай бұрын
am I the only one who thinks "progressive enhancment" is bs ?
@codedusting
@codedusting 9 ай бұрын
Yes 😂
@ray-lee
@ray-lee 7 ай бұрын
Yes
@gubocci
@gubocci 6 ай бұрын
Yes
@Sube_Gordas
@Sube_Gordas 5 ай бұрын
Yes
@loveboat
@loveboat 4 ай бұрын
Useful in 0.0001% of cases and has a fancy name
Error Handling in Server Actions Next.js (Incl. Toasts!)
10:30
Cute Barbie Gadget 🥰 #gadgets
01:00
FLIP FLOP Hacks
Рет қаралды 52 МЛН
Sprinting with More and More Money
00:29
MrBeast
Рет қаралды 178 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
Don't Make These Next.js Mistakes
13:01
Dave Gray
Рет қаралды 21 М.
React + Servers = Confusion
20:30
Theo - t3․gg
Рет қаралды 40 М.
The BEST way to host Next.js websites
17:37
ByteGrad
Рет қаралды 22 М.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 191 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 545 М.
Next.js Server Actions...  5 awesome things you can do
7:51
Beyond Fireship
Рет қаралды 252 М.
Next js 15 is Here… New Changes Again?!
8:13
JavaScript Mastery
Рет қаралды 105 М.
Cute Barbie Gadget 🥰 #gadgets
01:00
FLIP FLOP Hacks
Рет қаралды 52 МЛН