The 3 REAL benefits of Next.js Server Actions

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

КОМЕНТАРІ • 51

  • @ByteGrad
    @ByteGrad  4 місяці тому +2

    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.

  • @dopetag
    @dopetag Рік тому +12

    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!

  • @TheGrandChieftain
    @TheGrandChieftain Рік тому +19

    Server actions might make the actual request simpler, but React Query seems a lot better for managing the state of your fetch requests.

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

    your doing well man. im glad you joined the scene

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

    Thank you sir for this short video with very important information that I needed to hear.

  • @HaowardWang
    @HaowardWang 7 місяців тому +1

    Thanks for your clear explanation! ❤

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

    This is exactly what I was looking for. Thanks.

  • @saidibra9231
    @saidibra9231 Рік тому +5

    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  Рік тому

      Good idea

    • @berndeveloper
      @berndeveloper 11 місяців тому

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

      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.

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

    Appreciate the way you explain things

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

    Best explanation on UA-cam 🤩

  • @spas.z.spasov
    @spas.z.spasov 10 місяців тому

    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.

  • @JasonWongFing
    @JasonWongFing 11 місяців тому +1

    Thanks for your video and explanation! It's helpful to me!

  • @jorden123
    @jorden123 Рік тому +4

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

      turborepo? you create reusable components for each client (assuming they all use typescript/javascript)

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

      Yeah that is what I am not a fan of server action. There are made to be used by your nextjs front ONLY.

  • @ianc6418
    @ianc6418 9 місяців тому +1

    another great class. thank you

  • @martg0
    @martg0 7 місяців тому +1

    very interesting! clear explanation 👏 Would this apply for a datagrid too?

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

    Subscribed to this channel so hard! 👌🏻

  • @alvaro1728
    @alvaro1728 10 місяців тому

    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.

  • @alexnelson2119
    @alexnelson2119 9 місяців тому +1

    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.

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd 2 місяці тому +1

    Thank you so much

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

    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  Рік тому +1

      Yes, works outside forms too but you have to invoke the server action differently (not with ‘action’ attribute)

  • @satyak1337
    @satyak1337 Місяць тому

    Can you rate limit server acrions like api ? 😊

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

    Thank you

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

    Good explanation

  • @AnkitSharma-mu3oj
    @AnkitSharma-mu3oj Рік тому

    In previous video you told importing something inside "use client" component then whatever is imported also runs on client side ?

  • @appstuff6565
    @appstuff6565 10 місяців тому

    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?

  • @mekelilyasa9561
    @mekelilyasa9561 5 місяців тому

    what's the diffirent with php

  • @devarshihazarika4871
    @devarshihazarika4871 Рік тому +12

    am I the only one who thinks "progressive enhancment" is bs ?

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

      Yes 😂

    • @ray-lee
      @ray-lee 10 місяців тому +2

      Yes

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

      Yes

    • @Sube_Gordas
      @Sube_Gordas 8 місяців тому +1

      Yes

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

      Useful in 0.0001% of cases and has a fancy name

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

    When are you releasing you Next Js course?

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

      It’s super close. Make sure you’re subscribed to the email newsletter :)

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

    How do you reset the form without using useState for each input field?

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

      Well if you need the whole form reset, html forms have a reset method for wiping out inputs.

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

    is it work only for app folder ?

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

    what is the name of vs code theme?

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

    Thanks, how do I do it with dashboard and get data? outside of forms

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

      Best to use fetch in a server component to get data

  • @learner8084
    @learner8084 5 місяців тому

    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.

  • @SR-zi1pw
    @SR-zi1pw Рік тому +1

    Nice comparison

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

    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?