next.js - 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?
解决方案
推荐阅读
- python - 对于从 python 到 PHP 的循环转换问题
- testing - 如何让 Quarkus 多模块 CDI 在测试中工作?
- woocommerce - 无法将自定义购物车项目数据传递给 WC()->cart->add_to_cart() woocommerce 4.9
- byte - 估计 20 分钟乙烯基的存储容量(以位为单位),但如何计算?
- eclipse - Ldap Apache Directory Studio 无法在 osx big sur 中打开 Root DSE
- python - cx-freeze 生成一些文件,但因出现长错误而停止,
- sql - 按 id 更新多列
- ios - AR 在我的 iOS 14 和 Xcode 12.3 上的 iOS 应用程序中无法正常工作,世界跟踪性能受到资源限制的影响
- flash - 如何在 IBM Datastage Hierarchical Data 中替换 Flash
- python - Scray shell URL 返回 404 进行无限滚动