docs: clarify data fetching pattern (#59602)

You don't fetch data with Server Actions, but mutate.
This commit is contained in:
Lee Robinson 2023-12-19 20:24:21 -06:00 committed by GitHub
parent 2c48b8796b
commit 29fcd57ed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@ There are a few recommended patterns and best practices for fetching data in Rea
## Fetching Data on the Server
Whenever possible, we recommend fetching data on the server. This allows you to:
Whenever possible, we recommend fetching data on the server with Server Components. This allows you to:
- Have direct access to backend data resources (e.g. databases).
- Keep your application more secure by preventing sensitive information, such as access tokens and API keys, from being exposed to the client.
@ -17,7 +17,7 @@ Whenever possible, we recommend fetching data on the server. This allows you to:
- Reduce client-server [waterfalls](#parallel-and-sequential-data-fetching).
- Depending on your region, data fetching can also happen closer to your data source, reducing latency and improving performance.
You can fetch data on the server using Server Components, [Route Handlers](/docs/app/building-your-application/routing/route-handlers), and [Server Actions](/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
Then, you can mutate or update data with [Server Actions](/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
## Fetching Data Where It's Needed