Unverified Commit 258a453b authored by sommeeeR's avatar sommeeeR Committed by GitHub

docs: update note on caching and db/orms (#69695)

fixes: #69694

---------
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
Co-authored-by: 's avatarZack Tanner <1939140+ztanner@users.noreply.github.com>
parent 0da5c258
...@@ -97,7 +97,7 @@ let data = await fetch('https://api.vercel.app/blog', { cache: 'no-store' }) ...@@ -97,7 +97,7 @@ let data = await fetch('https://api.vercel.app/blog', { cache: 'no-store' })
### Fetching data on the server with an ORM or database ### Fetching data on the server with an ORM or database
This component will always fetch and display a dynamic, up-to-date list of blog posts. This page will be SSG by default. The page will be prerendered during `next build`. It can be revalidated using [Incremental Static Regeneration](/docs/app/building-your-application/data-fetching/incremental-static-regeneration).
```tsx filename="app/page.tsx" switcher ```tsx filename="app/page.tsx" switcher
import { db, posts } from '@/lib/db' import { db, posts } from '@/lib/db'
...@@ -129,7 +129,7 @@ export default async function Page() { ...@@ -129,7 +129,7 @@ export default async function Page() {
} }
``` ```
The database call is _not_ cached. This example would opt your Next.js application into [server-side rendering](/docs/app/building-your-application/rendering/server-components#dynamic-rendering). If you want to cache the response and allow the page to be prerendered, [see this example](#caching-data-with-an-orm-or-database). The database call will run again every time you revalidate the page using [Incremental Static Regeneration](/docs/app/building-your-application/data-fetching/incremental-static-regeneration).
### Fetching data on the client ### Fetching data on the client
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment