Skip to content

Commit 25a0eb5

Browse files
authored
docs: Update initial-query-data.md (TanStack#2215)
1 parent 8026f4b commit 25a0eb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/pages/guides/initial-query-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Getting initial data from the cache means the source query you're using to look
103103
104104
```js
105105
function Todo({ todoId }) {
106-
const result = useQuery(['todo', todoId], () => fetch('/todos'), {
106+
const result = useQuery(['todo', todoId], () => fetch(`/todos/${todoId}`), {
107107
initialData: () =>
108108
queryClient.getQueryData('todos')?.find(d => d.id === todoId),
109109
initialDataUpdatedAt: () =>
@@ -118,7 +118,7 @@ If the source query you're using to look up the initial data from is old, you ma
118118
119119
```js
120120
function Todo({ todoId }) {
121-
const result = useQuery(['todo', todoId], () => fetch('/todos'), {
121+
const result = useQuery(['todo', todoId], () => fetch(`/todos/${todoId}`), {
122122
initialData: () => {
123123
// Get the query state
124124
const state = queryClient.getQueryState('todos')

0 commit comments

Comments
 (0)