You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/framework/react/community/tkdodos-blog.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: tkdodos-blog
3
3
title: TkDodo's Blog
4
4
---
5
5
6
-
TanStack Query maintainer [TkDodo](https://twitter.com/tkdodo) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
6
+
TanStack Query maintainer [TkDodo](https://bsky.app/profile/tkdodo.eu) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
Copy file name to clipboardExpand all lines: docs/framework/react/guides/advanced-ssr.md
+5-7
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,15 @@ title: Advanced Server Rendering
5
5
6
6
Welcome to the Advanced Server Rendering guide, where you will learn all about using React Query with streaming, Server Components and the Next.js app router.
7
7
8
-
You might want to read the [Server Rendering & Hydration guide](./ssr) before this one as it teaches the basics for using React Query with SSR, and [Performance & Request Waterfalls](./request-waterfalls) as well as [Prefetching & Router Integration](./prefetching) also contains valuable background.
You might want to read the [Server Rendering & Hydration guide](./ssr.md) before this one as it teaches the basics for using React Query with SSR, and [Performance & Request Waterfalls](./request-waterfalls.md) as well as [Prefetching & Router Integration](./prefetching.md) also contains valuable background.
11
9
12
10
Before we start, let's note that while the `initialData` approach outlined in the SSR guide also works with Server Components, we'll focus this guide on the hydration APIs.
13
11
14
12
## Server Components & Next.js app router
15
13
16
14
We won't cover Server Components in depth here, but the short version is that they are components that are guaranteed to _only_ run on the server, both for the initial page view and **also on page transitions**. This is similar to how Next.js `getServerSideProps`/`getStaticProps` and Remix `loader` works, as these also always run on the server but while those can only return data, Server Components can do a lot more. The data part is central to React Query however, so let's focus on that.
17
15
18
-
How do we take what we learned in the Server Rendering guide about [passing data prefetched in framework loaders to the app](./ssr#using-the-hydration-apis) and apply that to Server Components and the Next.js app router? The best way to start thinking about this is to consider Server Components as "just" another framework loader.
16
+
How do we take what we learned in the Server Rendering guide about [passing data prefetched in framework loaders to the app](./ssr.md#using-the-hydration-apis) and apply that to Server Components and the Next.js app router? The best way to start thinking about this is to consider Server Components as "just" another framework loader.
19
17
20
18
### A quick note on terminology
21
19
@@ -532,7 +530,7 @@ export default function Posts() {
532
530
533
531
Now, your `getPosts` function can return e.g. `Temporal` datetime objects and the data will be serialized and deserialized on the client, assuming your transformer can serialize and deserialize those data types.
534
532
535
-
For more information, check out the [Next.js App with Prefetching Example](../../examples/nextjs-app-prefetching).
533
+
For more information, check out the [Next.js App with Prefetching Example](../examples/react/nextjs-app-prefetching).
536
534
537
535
## Experimental streaming without prefetching in Next.js
For more information, check out the [NextJs Suspense Streaming Example](../../examples/nextjs-suspense-streaming).
600
+
For more information, check out the [NextJs Suspense Streaming Example](../examples/react/nextjs-suspense-streaming).
603
601
604
602
The big upside is that you no longer need to prefetch queries manually to have SSR work, and it even still streams in the result! This gives you phenomenal DX and lower code complexity.
605
603
606
-
The downside is easiest to explain if we look back at [the complex request waterfall example](./request-waterfalls#code-splitting) in the Performance & Request Waterfalls guide. Server Components with prefetching effectively eliminates the request waterfalls both for the initial page load **and** any subsequent navigation. This prefetch-less approach however will only flatten the waterfalls on the initial page load but ends up the same deep waterfall as the original example on page navigations:
604
+
The downside is easiest to explain if we look back at [the complex request waterfall example](./request-waterfalls.md#code-splitting) in the Performance & Request Waterfalls guide. Server Components with prefetching effectively eliminates the request waterfalls both for the initial page load **and** any subsequent navigation. This prefetch-less approach however will only flatten the waterfalls on the initial page load but ends up the same deep waterfall as the original example on page navigations:
Copy file name to clipboardExpand all lines: docs/framework/react/guides/caching.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: caching
3
3
title: Caching Examples
4
4
---
5
5
6
-
> Please thoroughly read the [Important Defaults](./important-defaults) before reading this guide
6
+
> Please thoroughly read the [Important Defaults](./important-defaults.md) before reading this guide
7
7
8
8
## Basic Example
9
9
@@ -23,7 +23,7 @@ Let's assume we are using the default `gcTime` of **5 minutes** and the default
23
23
- A second instance of `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` mounts elsewhere.
24
24
- Since the cache already has data for the `['todos']` key from the first query, that data is immediately returned from the cache.
25
25
- The new instance triggers a new network request using its query function.
26
-
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](../reference/useQuery) are updated (including `isFetching`, `isPending`, and other related values) because they have the same query key.
26
+
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](../reference/useQuery.md) are updated (including `isFetching`, `isPending`, and other related values) because they have the same query key.
27
27
- When the request completes successfully, the cache's data under the `['todos']` key is updated with the new data, and both instances are updated with the new data.
28
28
- Both instances of the `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` query are unmounted and no longer in use.
29
29
- Since there are no more active instances of this query, a garbage collection timeout is set using `gcTime` to delete and garbage collect the query (defaults to **5 minutes**).
Dependent queries by definition constitutes a form of [request waterfall](../../../react/guides/request-waterfalls), which hurts performance. If we pretend both queries take the same amount of time, doing them serially instead of in parallel always takes twice as much time, which is especially hurtful when it happens on a client that has high latency. If you can, it's always better to restructure the backend APIs so that both queries can be fetched in parallel, though that might not always be practically feasible.
93
+
Dependent queries by definition constitutes a form of [request waterfall](./request-waterfalls.md), which hurts performance. If we pretend both queries take the same amount of time, doing them serially instead of in parallel always takes twice as much time, which is especially hurtful when it happens on a client that has high latency. If you can, it's always better to restructure the backend APIs so that both queries can be fetched in parallel, though that might not always be practically feasible.
94
94
95
95
In the example above, instead of first fetching `getUserByEmail` to be able to `getProjectsByUser`, introducing a new `getProjectsByUserEmail` query would flatten the waterfall.
Copy file name to clipboardExpand all lines: docs/framework/react/guides/initial-query-data.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ There are many ways to supply initial data for a query to the cache before you n
8
8
- Declaratively:
9
9
- Provide `initialData` to a query to prepopulate its cache if empty
10
10
- Imperatively:
11
-
-[Prefetch the data using `queryClient.prefetchQuery`](../../../react/guides/prefetching)
12
-
-[Manually place the data into the cache using `queryClient.setQueryData`](../../../react/guides/prefetching)
11
+
-[Prefetch the data using `queryClient.prefetchQuery`](./prefetching.md)
12
+
-[Manually place the data into the cache using `queryClient.setQueryData`](./prefetching.md)
13
13
14
14
## Using `initialData` to prepopulate a query
15
15
@@ -170,6 +170,6 @@ const result = useQuery({
170
170
171
171
## Further reading
172
172
173
-
For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](../community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).
173
+
For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](../community/tkdodos-blog.md#9-placeholder-and-initial-data-in-react-query).
Copy file name to clipboardExpand all lines: docs/framework/react/guides/migrating-to-react-query-3.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -103,8 +103,8 @@ try {
103
103
104
104
Together, these provide the same experience as before, but with added control to choose which component trees you want to reset. For more information, see:
0 commit comments