Next.js 14 Tutorial - 69 - Request Memoization

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024

Комментарии • 11

  • @paulromeo5395
    @paulromeo5395 4 месяца назад +2

    I am a bit confused about tutorial 69: with data fetch with caching, it would be no surprise that it will be caching on subsequent "reload this page", that is no further data fetch from the node server. So the request memoization in this tutorial is not proven to work.

    • @chinemelumchuba-nwene1503
      @chinemelumchuba-nwene1503 3 месяца назад +2

      Consider a scenario where a GET request is made from the browser to the server. As React renders the component tree on the server, it avoids replicating fetch requests to the same URL with identical options during that render pass, regardless of where the fetch request occurs in the component tree. This process is known as request de-duplication. Request memoization persists for the duration of a render pass of the component tree. Once a new request is made, React clears the in-memory storage for memoized requests and starts anew.
      The data cache, on the other hand, remains persistent across multiple requests unless explicitly opted out of. Unlike request memoization, which does not persist across requests and render passes, the data cache ensures the data's longevity beyond individual render passes. I hope this helps.

  • @quannguyenviet643
    @quannguyenviet643 3 месяца назад +1

    actually , the page.tsx fetch data before layout.tsx fetch data, i call request from 2 component and then .log so log of page show before layout.tsx

  • @friderichwisniewski8154
    @friderichwisniewski8154 9 дней назад

    superb explanation

  • @yuvrajsaraswat8505
    @yuvrajsaraswat8505 4 месяца назад

    I want to watch the whole playlist, so please can you just tell me how many more videos are left, and it will take how many day😊

  • @rizkifahruroji5047
    @rizkifahruroji5047 4 месяца назад

    Please create tutorial cache using third-party libraries or mysql

  • @fakedevdutt
    @fakedevdutt 4 месяца назад

    finally 69

  • @ahmedkhalid-ld1ex
    @ahmedkhalid-ld1ex 4 месяца назад

    First 😁😁

  • @abheygupta2332
    @abheygupta2332 4 месяца назад

    Please make a video on how to enable cors

    • @GabrielLogan17
      @GabrielLogan17 4 месяца назад +1

      You can do as
      import { createSecureHeaders } from "next-secure-headers";
      /** @type {import('next').NextConfig} */
      const nextConfig = {
      async headers() {
      return [
      {
      source: "/(.*)",
      headers: [
      ...createSecureHeaders({
      forceHTTPSRedirect: [
      true,
      { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true },
      ],
      referrerPolicy: "same-origin",
      }),
      {
      key: "Cross-Origin-Opener-Policy",
      value: "same-origin",
      },
      {
      key: "Cross-Origin-Embedder-Policy",
      value: "require-corp",
      },
      ],
      },
      ];
      },
      };
      export default nextConfig;

    • @abheygupta2332
      @abheygupta2332 4 месяца назад

      @@GabrielLogan17 thank you😄