//Similar to 'getStaticProps' when used in a static rendering componentfetch(API_URL)
giống như yêu cầu 'force-cache' này:
//This request would be cached until manually invalidated. //Similar to 'getStaticProps'//Use this type of fetching for data that does not change often.fetch(API_URL, { cache:'force-cache' })
exportdefaultasyncfunctionPage() {// This request should be cached until manually invalidated.// Similar to `getStaticProps`.// `force-cache` is the default and can be omitted.conststaticData=awaitfetch(`https://...`, { cache:'force-cache' })// This request should be refetched on every request.// Similar to `getServerSideProps`.constdynamicData=awaitfetch(`https://...`, { cache:'no-store' })// This request should be cached with a lifetime of 10 seconds.// Similar to `getStaticProps` with the `revalidate` option.constrevalidatedData=awaitfetch(`https://...`, { next: { revalidate:10 }, })return <div>...</div>}