首页 > 解决方案 > How do you share data over multiple getStaticProps calls?

问题描述

If I was building a Next.js static site with alot of pages, 100,000 for example. How would I limit the number of api calls we are using to generate these?

For example if each of these pages needed to call an external API to get a unique image paths for each page, but how do I avoid making 100,000 calls to the external API.

I can fetch all the image paths up front, but how do I store these in scope across multipe calls to getStaticProps?

I understand this could be done in getStaticPaths but that seems like an anti pattern?

标签: next.js

解决方案


推荐阅读