What did Next.js Server Actions actually accomplish? And Other Questions...

Поділитися
Вставка
  • Опубліковано 28 чер 2024
  • Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
    What did Next.js Server Actions actually accomplish? We explore the answer to this and other subscriber questions.
    💖 Support me on Patreon ➜ / davegray
    ⭐ Become a full-stack web dev with Zero To Mastery Courses:
    - Complete Next.js Developer: bit.ly/CompNextJSDev
    - Advanced React: bit.ly/AdvReactDev
    - Junior to Senior Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
    🚩 Subscribe ➜ bit.ly/3nGHmNn
    📬 Course Updates ➜ courses.davegray.codes/
    ❓ Questions - Please post them to my Discord ➜ / discord
    ☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
    🔗 My Next.js Videos: • Next.js Tutorials for ...
    👇 Follow Me On Social Media:
    GitHub: github.com/gitdagray
    Twitter: / yesdavidgray
    LinkedIn: / davidagray
    What did Next.js Server Actions actually accomplish? And Other Questions...
    Was this Subscriber Question & Answer video helpful? If so, please share. Let me know your thoughts in the comments.
    #nextjs #server #actions

КОМЕНТАРІ • 66

  • @alexjando4880
    @alexjando4880 3 місяці тому +7

    Just finished your react tutorial. Ive probably watched 50hrs of your videos. Theyre so awesome. Keep it up!

  • @janithchamikara3062
    @janithchamikara3062 3 місяці тому +2

    Great content as always Dave

  • @BemdooMaor
    @BemdooMaor 2 місяці тому

    Thank you very much for this Video. Like I was thrilled to see my question there. Thanks alot Dave

  • @raphauy
    @raphauy 3 місяці тому

    Thank you Dave!

  • @7doors847
    @7doors847 3 місяці тому

    Very insightful. Thanks!

  • @faroukallani982
    @faroukallani982 3 місяці тому +1

    Your way of explaining things is just wow!

  • @saeedkhazalvand4821
    @saeedkhazalvand4821 3 місяці тому

    Like always it was great 🎉

  • @efronic
    @efronic 3 місяці тому

    Thanks, Dave, for your insightful content. I’ve really enjoyed your videos and find myself curious about your music. Could you share how I can listen to your tunes?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      Thanks! I just play 80s rock covers mostly. Posting those results in copyright issues but I did share one link in response to another comment yesterday. Just a quick video someone took with their phone.

  • @CodeZakk
    @CodeZakk 3 місяці тому

    Thank very useful. On the next can you make a tutorial on using nextjs api vs custom server. Showing different situation in which nextjs api fit and not fit??

  • @mahdiuser100p8
    @mahdiuser100p8 3 місяці тому

    keep up the good work dave

  • @KapilSharma-mi8tx
    @KapilSharma-mi8tx 2 місяці тому

    Can u make more videos on rtk query with complex use cases

  • @27sosite73
    @27sosite73 3 місяці тому

    do not know about guitar) but getting data can be done using actions when you plug them into SWR or React query. Instead of creating an OG endpoint you can fetch using server actions

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      I have heard of this, but it's not a recommended pattern in the docs so I didn't recommend yet. That said, I agree it's possible. ...And following up on this, the docs do ever so briefly mention using third party libraries with server actions: "Server Actions are not limited to and can be invoked from event handlers, useEffect, third-party libraries, and other form elements like ." (nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#behavior) It would be nice if either the Next.js docs or the SWR docs provided an example. The leading statement in the docs of "form submissions and mutations" feels misleading in this regard with fetching possible via 3rd party library. Definitely not the only confusing thing about Next.js lol. Thank you for inspiring me to dig deeper on this!

  • @jitx2797
    @jitx2797 3 місяці тому +1

    Somethings that I find limiting in Next.js:
    Server Components can't mutate the header and cookies as well
    Middleware can't use node runtime
    When I see something like Astro I can do this easily(mutating cookies) in Astro..

    • @zuma206
      @zuma206 3 місяці тому

      import { cookies, headers } from "next/headers";
      cookies().set("username", "jitx2797");
      headers().set("X-Whatever", "some-text");

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      You are not alone 🙌

  • @jeffreykwakye8597
    @jeffreykwakye8597 3 місяці тому

    I like your videos! I just finished the 1 hour jwt authentication with nodejs and express for beginners tutorial. I was wondering if you have a frontend video that uses react to interact with that code from the tutorial? Thanks

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      Thanks! Yes, this playlist uses React on the frontend and the REST API you built in the Node.js course: ua-cam.com/play/PL0Zuz27SZ-6PRCpm9clX0WiBEMB70FWwd.html

    • @jeffreykwakye8597
      @jeffreykwakye8597 3 місяці тому

      @@DaveGrayTeachesCode
      Thank you. does each tutorial build on the previous ones or I can decide to pick which ones i want to watch.

  • @domson_0478
    @domson_0478 3 місяці тому

    I run Next.js apps simply with pm2 on VPS. It works as needed.

    • @dev-akeel
      @dev-akeel 3 місяці тому +1

      VPS is kind of serverless++. It runs all the time so how can you expect it not to work properly.

    • @domson_0478
      @domson_0478 3 місяці тому +1

      @@dev-akeel I do not expect it not to work properly. I don't even try. I simply did answer like comment for one of the questions from video.

  • @creatorsremose
    @creatorsremose 3 місяці тому

    I liked Eldad's question... similar fears and scares were prominent and publicized during the 70s (with the introduction of high-level programming languages) and 90s (with the introduction of visual GUI programming). In both cases engineers were concerned that the bar for entry into software engineering was lowered too far and their special skill set had become redundant. Much like Dave said, these things ended up becoming tools for engineers rather than a replacement for them, which I believe AI will eventually be.

  • @dev-akeel
    @dev-akeel 3 місяці тому

    I have encountered the challenge "Do what I want not what I said" a multiple times.
    And I almost always failed till now, but I think I am becoming better atleast I can understand little bit what stackholder wants.
    I want you to create a video (if you can invite a few real world stack holders ) and then convert their saying to what they want.
    It would be really impressive.

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому +1

      It is always a challenge. I'm thankful for it though. If stakeholders could communicate clearly and concisely, it would be easier to be replaced by AI.

    • @dev-akeel
      @dev-akeel 3 місяці тому

      @@DaveGrayTeachesCode I think we need ourselves to be best and stackholders to be worst.

  • @bioburden
    @bioburden 3 місяці тому

    When it comes to music, what amp and pedals are you using?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      I've used Orange amps and cabs for over 10 years now. I try to minimize pedals but a couple of faves are the MXR Carbon Copy and EVH Phase 90.

    • @bioburden
      @bioburden 3 місяці тому

      @@DaveGrayTeachesCode Oh nice, some British rock tones and you can't go wrong with a classic delay and Eddie's phaser 🤘

  • @procastinator3645
    @procastinator3645 3 місяці тому

    I enjoy this type of content...hey! Parallel routes can archive the modal in the table been fetch in a server component? If the answer is yes maybe is too much for asking but parallel routes seems very powerful but undocumented in my opinion 😂 ,greats from 🇨🇺! You are the best!!!

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому +1

      Thanks for the feedback! 🙌 I need to make a video on Parallel routes. Parallel routes could be good for rendering individual form components for example.
      The situation I described in the video: You have received data from the parent server component which populates a table. Now you can pick any row item from the table and request more data about it. You don't know in advance which item a user will pick. Requesting ALL the data for ALL items in advance would be way too much - so instead, request on demand for any given item. If you want to stay on the page and display it in a dialog/modal, then a route handler is likely the way to go.

    • @procastinator3645
      @procastinator3645 3 місяці тому

      @@DaveGrayTeachesCode thanks for your time...😁😁😁

  • @hellokevin_133
    @hellokevin_133 3 місяці тому

    Hey dave sorry for off-topic question but is it a good idea to learn React & node/express at the same time ? I know I wanna go full stack but some say I should first learn react to a decent level then begin learning backend, not sure what's the right call.

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      You can learn either one first but I don't recommend at the same time.

    • @DeepJasoliya
      @DeepJasoliya 3 місяці тому

      In my opinion, you should first have strong foundation in vanilla js then you can go for anything react or node doesn't matter but not at same time. one by one

  • @kenchowangdi5880
    @kenchowangdi5880 3 місяці тому

    Is route handler actually what is called api?it is often confusing the definition of api in the real world,what does api routes usually means?does that means the files under api folder of app router,nextjs treated at api routes?do we actually fetch data from backend by calling this api routes by using anxis ?in which api routes actually interact with db to fetch data?.can you explain this whole concept Dave in one video

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      API routes = route handlers as a mental concept. Really, the API route is the route and the code that handles requests to that route is the route handler. I discuss them some here and much more in my Next.js course and other Next.js videos - all found on this channel.

  • @mitalicops8538
    @mitalicops8538 3 місяці тому

    For me personally next js server actions have made it easier to tap into backend.
    Paired with prisma its a great duo.
    Before we had all those api routes, its quite confusing for beginners that wanted to get into fullstack.

  • @gerkim3046
    @gerkim3046 3 місяці тому

    where can i get videos or pictures of you singing or playing guitar?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      For 8+ years I used to travel every weekend with an 80s band called Paramount. I left the band back in 2019, but here is a fan video from 7 years ago where I was playing lead guitar. I get introduced at about 40 seconds in: ua-cam.com/video/x9ZkP6KqiRw/v-deo.htmlsi=bUKsMoIAv0FG-sse ..I don't play every weekend these days and I definitely don't travel with a band much now.

  • @kevl7129
    @kevl7129 3 місяці тому +1

    For my money server actions are a bit of a misnomer as they are apparently essentially deployed as on-demand 'serverless' functions (itself a misnomer 😂) with all the same pros and cons. For instance they will struggle with any long-running tasks as Vercel time-limits them

  • @ViCkY-ft3zt
    @ViCkY-ft3zt 3 місяці тому +2

    I wonder why some really really good channels have less subs.
    You deserve much more.
    Maybe Dave is a really good teacher but not a good marketer

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому

      I was thinking about making a video on this topic. I could play to the algorithm more, but it is not what I want to accomplish. My main focus is education. That said, I'm currently approaching 300k subs, and having my best month yet. 💯

  • @hakanaki
    @hakanaki 3 місяці тому

    is it possible to host NextJS else where without Docker?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому +1

      I think some are, but I don't currently know the details. As mentioned here, I've always used Vercel. To answer the question in this video, I went with the official docs recommendation of using Docker if you want to host elsewhere.

    • @hakanaki
      @hakanaki 3 місяці тому

      ​@@DaveGrayTeachesCode I created an LMS website for a client in India which I hosted on Vercel but they weren't able to access it even weeks after it was deployed
      That's why I'm currently exploring other options like AWS which I've been avoiding 🤣🤣🤣🤣

  • @jitx2797
    @jitx2797 3 місяці тому +1

    4:18 currently I am hosting next.js on my own self hosted servers and things work great. Just not speedy enough as vercel coz vercel user cf workers for middlewares and edge function deployment so it is fast.
    Still I am fully able to host with all the services running. I found this linked video interesting on basic CI CD deployment for automatic deployments on code push
    ua-cam.com/video/fkzpywlJcMA/v-deo.html

  • @saeedkhazalvand4821
    @saeedkhazalvand4821 3 місяці тому

    Dave , I m doing a chat app and I have problem , I want you check you my project , how can I send to you ?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 місяці тому +1

      You can book one of the mentorship meetings mentioned in this video. While I make free content for UA-cam, I must charge for my limited time and individual help.

    • @saeedkhazalvand4821
      @saeedkhazalvand4821 3 місяці тому

      @@DaveGrayTeachesCode much love to you🥰

  • @jouiedomar1922
    @jouiedomar1922 2 місяці тому

    How to add csrftoken validation to post handler function in route.ts (nextjs app route)

  • @PlayhouseMediaGroup
    @PlayhouseMediaGroup 3 місяці тому +1

    today I am the first, thank you @DaveGray