Server-Side Rendering (SSR)
The Next.js-specific line `export const revalidate = 0
` has been added, which tells Next to constantly invalidate the cache for this page.This means that its content is generated at run-time whenever the user requests the page.
This is slower than SSG or ISR, but will keep the content continuously up-to-date.
Try it by updating the note here and refreshing this page.
This is the content of that note, according to this page rendered with SSR:
And this is the value of "lastUpdated" for the note:
This is the content of that note, according to this page rendered with SSR:
Change this text! Bleh!!!
Wed Apr 10 2024 16:53:14 GMT+0000 (Coordinated Universal Time)
The pseudo-code for this page is:
export const revalidate = 0;
export async function SSR({}) {
const pool = await DBConnector.getPool();
const data = await pool.query("SELECT...");
return <div>
The content of this page: {data}
</div>;
}
export async function SSR({}) {
const pool = await DBConnector.getPool();
const data = await pool.query("SELECT...");
return <div>
The content of this page: {data}
</div>;
}
5