Next.js 13 - How to ACTUALLY use Server Actions (caching & revalidation)

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 14

  • @o.voytyn
    @o.voytyn Před 7 měsíci +1

    Why do we use server actions here in order to make a call to an api. We can do this by calling fetch on the client. I thought that benefits of using server actions not ot use an api call but having a direact access to the db in the server action.

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Před 6 měsíci +1

      Good question! There are bunch of other benefits too on top of the direct db access for example the api call most likely is faster from the server, the client side bundle is smaller because it doesnt have to include the fetching logic, seo benefits, initial page load and fcp are faster, caching.

  • @fernanjoui
    @fernanjoui Před 5 měsíci

    is there a way to use it without rerendering the whole page? you can see that the whole component tree re-rendered, even thought the only thing that changed was the list.

  • @UditD72
    @UditD72 Před 5 měsíci

    If I dont add "use server", will it save it to browser cache?

  • @toastrecon
    @toastrecon Před 11 měsíci

    Man, I don't know what I'm doing wrong, but I get to 5:47, and I'm getting "Error: fetch failed". I can click on the link to the JSON endpoint on 3001, and it shows up just fine, but I can't get the other project to perform the fetch. Is it some kind of CORS setting or something? I'll try a few more things.

  • @eedeenet
    @eedeenet Před 6 měsíci

    what theme are you using in vscode?

  • @waleedsharif618
    @waleedsharif618 Před 11 měsíci

    Kuulostat yhdeltä mun it opettajalta jonka nimi on Timo :) hänelläkin sama sukunimi

  • @jeesmonjoy852
    @jeesmonjoy852 Před 9 měsíci +3

    wtf with background music at start 🤣🤣

    • @abernier
      @abernier Před 8 měsíci

      maybe a bit too epic 😅

    • @paulhendricks2433
      @paulhendricks2433 Před 6 měsíci

      Yeah I can't get past that. I'm about to click the browser back button. Bye.

  • @cetingokdeniz
    @cetingokdeniz Před 11 měsíci

    57 seconds ago.. ❤