我从我的 getstaticprops 中的外部 API 获取大量 json 数据。然后将这些数据分成几部分作为道具发送到其他静态页面(数百个页面)。
// page1.tsx
const page1 = ({ page1Data }) => {
...
}
const getStaticProps: GetStaticProps = async () => {
const res = await fetch('https://hugedata')
const jsonData = await res.json()
const { page1Data, page2Data, page300Data, ...allData } = jsonData
return { props: { page1Data } }
}
我只知道如何将 staticprops 数据发送到文件中的组件,就像这样。
有没有办法将这些数据发送到其他静态页面/路由?(例如到 page2.tsx)