Next.js Server Actions || Learn Patterns & Project Building

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024

ความคิดเห็น • 53

  • @soumyajeetdas5339
    @soumyajeetdas5339 2 วันที่ผ่านมา

    You are just doing an awesome work. You literally spoke about some extremely imp things, that's very imp to note

    • @tapasadhikary
      @tapasadhikary  2 วันที่ผ่านมา

      @@soumyajeetdas5339 Thanks a lot ❤️

  • @mdsumonh.shohan9159
    @mdsumonh.shohan9159 7 วันที่ผ่านมา

    Great great I love it i wached it very carefully and very being fosued. thank you vai I learnt so much

    • @tapasadhikary
      @tapasadhikary  2 วันที่ผ่านมา

      @@mdsumonh.shohan9159 Thank you very much ❤️

  • @Arindam_1729
    @Arindam_1729 2 หลายเดือนก่อน

    Super Helpful video Dada, Thanks ❤

    • @tapasadhikary
      @tapasadhikary  หลายเดือนก่อน +1

      Thanks vai.. somehow your message was blocked by YT, donno the reason.

  • @MdMuzahid-p9t
    @MdMuzahid-p9t 2 หลายเดือนก่อน +1

    Informative video, Thanks for sharing with us.❤

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      You are most welcome ❤️

  • @i_m_phoenix87
    @i_m_phoenix87 2 หลายเดือนก่อน

    Nice Explanation Sir . I also feel , it is more of an intuitive approach than a practical one to add server actions in Next JS but once you get used to it , it makes it way easier to handle api calls and manage the integration stuffs. Loved this video and I must say , i am enjoying this journey of Next JS with you. Thanks and Keep going Sir.

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thanks for adding to it. Yep, I'm also enjoying making it a lot 😀

  • @tharunkumarreddy1224
    @tharunkumarreddy1224 หลายเดือนก่อน +1

    Thank you so much sir😊

  • @Aleks-fp1kq
    @Aleks-fp1kq 2 หลายเดือนก่อน +1

    Thank you. Got a bit of mixed feelings as server actions seems to be mixing concerns. They were imagined to replace API endpoints - data mutation, but now we also do revalidation and this adds a layer of magic because what actually a call to server action returns is not just what we explicitly return from it.

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      I second that opinion 👍

  • @suvasispatra6389
    @suvasispatra6389 2 หลายเดือนก่อน +2

    loving your contents!

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thanks a lot ❤️

  • @JJMV-sl1ib
    @JJMV-sl1ib 2 หลายเดือนก่อน

    Great video as always, very informative and motivational!

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thanks a lot… hard work pays off when you love it ❤️❤️

  • @morsheddld
    @morsheddld 2 หลายเดือนก่อน +1

    it's a great content

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thank you ❤️

  • @steffenjusmann6276
    @steffenjusmann6276 2 หลายเดือนก่อน +1

    Great video once again!

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thanks a lot ❤️

  • @abdullahalmuzahid2473
    @abdullahalmuzahid2473 2 หลายเดือนก่อน +1

    Informative tutorial.. ❤❤❤

  • @lonewolfdays
    @lonewolfdays 2 หลายเดือนก่อน +1

    Thanks for this amazing explanation. I have a confusion. When to use fetch/axios and when to use actions? Or they can be used together? For example, if i consider jsonplaceholders APIs as API points which approch should be followed in the nextjs api for data fetching? I'm some what confused between these. You can correct me if my question is wrong. Thank you.

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน +1

      @@lonewolfdays when you have an external API to call, you will not use server actions. That time you will have two approaches:
      1. From the Server component you can fetch the data directly from API using the fetch() and use.
      3. If from the client component then you can use the useEffect() hook to handle API calls and responses.
      On the contrary, server actions are simple functions that are asynchronously executed on the server and you can call them with the 5 patterns I mentioned in the video.
      I hope the diff is clear to you now.

  • @aminulislamshykat
    @aminulislamshykat 2 หลายเดือนก่อน

    Very helpful tutorial sir.

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      Thank you ❤️❤️

  • @harshkhasgiwale2709
    @harshkhasgiwale2709 2 หลายเดือนก่อน +1

    Thank You Sir

  • @wasiuddinmansoori3385
    @wasiuddinmansoori3385 2 หลายเดือนก่อน

    Great Informative Video Brother. One Doubt is why we not used timestamps and used createdAt instead in the video ?

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน +1

      Thanks brother ❤️, yes! We can do timestamp: true as well to add createdAt, modifiedAt. Please feel free to use that too 👍

    • @wasiuddinmansoori3385
      @wasiuddinmansoori3385 2 หลายเดือนก่อน

      @@tapasadhikary Thankyou So Much

  • @angelaparga8398
    @angelaparga8398 2 หลายเดือนก่อน +1

    Thanks again Tapas for this information. I have a question, if I want to use a dedicated express server for my backend and I use 'server actions' to make the API calls to maintain these calls on the server, is it really consuming? Am I wrong doing this?

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน +1

      Thank you!
      If you have a dedicated server self-managed, it's not an issue. The problem comes when we have a cloud hosted server that charges on execution based on bandwith and time.

  • @PhillipJacowski-er1ch
    @PhillipJacowski-er1ch 26 วันที่ผ่านมา +1

    When you use a server action will the call towards the node server be shown in the web inspector's network tab? I swear I am doing everything correctly but I get that the JSON isn't serializable - I've even reduced it down to just a string I'm passing. Also, how come you aren't using the .bind() approach mentioned in the next.js docs? It's like you are skipping some of their patterns

    • @tapasadhikary
      @tapasadhikary  26 วันที่ผ่านมา +1

      Hey Man, I hope your problem is solved by now. No we can not trace them like regular http/network calls in DevTools. One way to inspect them is if you have a middleware there you can check out the values being passed. If it is just string, I do not see a problem at all... as a double check, please re-look how are you extracting the form data or adding anything additional to the server action apart from the form data.
      About the .bind(), it is not necessarily a server action thing, that's plain old JavaScript. However, I agree with you that it will be good to capture it, I shall make a smaller video on it soon. Thanks!

    • @PhillipJacowski-er1ch
      @PhillipJacowski-er1ch 20 วันที่ผ่านมา +1

      @@tapasadhikary Thanks for reaching out, it was actually that I had the content-type of the request on the wrong level either in or outside the headers.... i was going crazy haha thanks!

  • @Pushkarcdn
    @Pushkarcdn หลายเดือนก่อน +1

    sir, I'm facing an issue related to api in next js.
    I have made api under src/app/api... that api is getting data from mongo db atlas... and fetching that api on /home route.
    Running locally is everything good.
    But when deployed to vercel or heroku, and then I fetch that api, it always gives the old data that was in the db while the time of deployment...
    Even if the data is updated on the db, still it gives the old data.
    How should I fix it?
    Or these platform does not support giving dynamic data.?

    • @tapasadhikary
      @tapasadhikary  หลายเดือนก่อน

      @@Pushkarcdn fetch is memoized in production. Make sure to use a cache revalidation strategy or cache no store strategy.

    • @Pushkarcdn
      @Pushkarcdn หลายเดือนก่อน

      @@tapasadhikary I've already used this:
      const response = await fetch('/api/messages',
      {
      method: 'GET',
      headers: {
      'Content-Type': 'application/json',
      'Cache-Control': 'no-store',
      },
      })

    • @tapasadhikary
      @tapasadhikary  หลายเดือนก่อน

      @@Pushkarcdn Are you also using unstable_noStore?

    • @Pushkarcdn
      @Pushkarcdn หลายเดือนก่อน +1

      @@tapasadhikary Sir the issue is solved. I just used the req object inside the api route - let a = request.url... However the a variable is not used anywhere.

  • @whysumancode
    @whysumancode 2 หลายเดือนก่อน

    upto 32:06 and wake me up!

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      What does it mean? 😃

    • @whysumancode
      @whysumancode 2 หลายเดือนก่อน

      @@tapasadhikary Hehe I know I will be busy on my college project. So somebody has to inform me to finish this tutorial. That's why

  • @AvikNayak_
    @AvikNayak_ 2 หลายเดือนก่อน +1

    Has this course ended or ongoing?

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      I am making an end to end app where a Node.js and Express Service will create the auth token and refresh token.. and at the Next.js end the next-auth will be regulating the tokens and all other API services will go through that. There will be multiple videos for that app.. and some of them will available to view as I progress.. some part may be member-only too as it takes a lot of efforts to cover everything, hope you understand. Rest all are covered here.

  • @rifatrahman1417
    @rifatrahman1417 2 หลายเดือนก่อน +1

    make some video also in Bangla so we can understand better

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน

      yep, sure. Please watch out @tapascript-bangla for Bangla videos. Thanks!

  • @whysumancode
    @whysumancode 2 หลายเดือนก่อน

    Tomorrow is my exam why i can't skip this tutorials❤‍🩹

    • @tapasadhikary
      @tapasadhikary  2 หลายเดือนก่อน +1

      Exam first 😊😉

    • @whysumancode
      @whysumancode 2 หลายเดือนก่อน +1

      @@tapasadhikary will be back for sure dai💯!