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

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

КОМЕНТАРІ • 17

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

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

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

  • @jafir.r
    @jafir.r 28 днів тому

    thank you for your work❤

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

    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.

  • @o.voytyn
    @o.voytyn 8 місяців тому +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  8 місяців тому +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.

    • @christoffertoftpersson895
      @christoffertoftpersson895 20 днів тому

      @@TuomoKankaanpaa Also not all API calls are the same. For example, you might want to access an external api using the apps keys as authentication, while not exposing them to the client.

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

    what theme are you using in vscode?

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

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

  • @jeesmonjoy852
    @jeesmonjoy852 10 місяців тому +3

    wtf with background music at start 🤣🤣

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

      maybe a bit too epic 😅

    • @paulhendricks2433
      @paulhendricks2433 8 місяців тому

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

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

    57 seconds ago.. ❤