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?

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.

Further reading

Problem with a question

Next.js · Middle · question 26

Test yourself

Take the Next.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz