Fetch data only once , and pass it to async generate metadat and async page?
Unanswered
English Spot posted this in #help-forum
English SpotOP
Any tips on how can i fetch once and pass it to both functions?
1 Reply
Create a separate function that makes the fetch request and returns your data and then call it both inside
generateMetadata and your page. Don't worry about fetching twice cause Next will de-duplicate the request and fetch your data only once.