Is there a way to render a page statically with a server component rendered on demand?
In the example below, I’d like Home
page to be statically rendered in the build time so that the document request can be cached but keep ServerComponent
dynamic, loaded on demand.
export default function Home(){
return (
<>
<h1>Page title</h1>
<Suspense loading="Loading..."><ServerComponent/></Suspense>
</>
)
}
I’m aware this can be achieved partially via streaming, but in this case, the page isn’t static, it’s generated on each request.
I also understand that I can achieve this by using a client component but I’m curious is it possible to get such behavior with a server component?