Next.js · Middle · Question 26 of 75
In the App Router, how do you get data for generateMetadata and the page without fetching the API twice via fetch?
- ✓Correct answer: Do nothing: identical
fetches within one render are deduplicated - 2Save the response to
localStorageand read it the second time - 3Use
getStaticPropsnext to thegenerateMetadatafunction
Explanation
Request memoization: GET fetch requests with the same URL and options within one render run once. For other data sources (ORM, SDK), use React's cache(). getStaticProps doesn't work in the App Router.