# 性能优化坑
# force-static
- 注意避免页面的Link,prefetch可能会预加载链接失效
- 在页面中使用Link组件,并设置prefetch为false
<Link href="/about" prefetch={false}>About</Link>
1
# ISR(Incremental Static Regeneration)
- 定期让缓存失效
export const revalidate = 3600;
1
- 适用场景
export const revalidate = 3600;
export default async function PricingPage() {
const pricing = await fetch("https://cms.xxx/pricing").then(r => r.json());
return <div>价格:{pricing.price}</div>;
}
1
2
3
4
5
6
7
2
3
4
5
6
7