nextJS的getStaticPaths性能是什么?

时间:2020-08-17 19:37:33

标签: next.js

我想创建一堆静态页面,但是我不确定next.js是否可以使用它。使用默认设置的盖茨比掉落了。 我想显示3种类型的数据,分别生成15/50/150 k页 我希望以后可以每天重建(150k)。 nextJS会处理吗?我有什么时间可以看一下吗?

如果我理解正确

export async function getStaticPaths() {
    // Call an external API endpoint to get cities
    const res = await fetch('https://.../cities')
    const cities = await res.json()
  
    // Get the paths we want to pre-render based on cities
    const paths = cities.map((post) => ({
      params: { id: post.id },
    }))
  
    // We'll pre-render only these paths at build time.
    // { fallback: false } means other routes should 404.
    return { paths, fallback: false }
  }

除了要进行一次调用之外,我将不得不重复调用fetch,直到将所有数据都放在一个变量中为止,但是我有点担心一切都会崩溃。 伙计们,您的想法是什么?

UPD https://static-tweet.now.sh/应该是我的答案

0 个答案:

没有答案