Skip to content

Commit 63c32ec

Browse files
authored
Update README.md (TanStack#660)
1 parent b3e4dda commit 63c32ec

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ import { useQuery } from 'react-query'
525525

526526
useQuery({
527527
queryKey: ['todo', 7],
528-
queryFn: fetchTodos,
528+
queryFn: fetchTodo,
529529
config: {},
530530
})
531531
```
@@ -553,7 +553,8 @@ const { isIdle, data: projects } = useQuery(
553553
}
554554
)
555555

556-
// isIdle will be `true` until `enabled` is true and the query begins to fetch. It will then go to the `isLoading` stage and hopefully the `isSuccess` stage :)
556+
// isIdle will be `true` until `enabled` is true and the query begins to fetch.
557+
// It will then go to the `isLoading` stage and hopefully the `isSuccess` stage :)
557558
```
558559

559560
## Caching & Invalidation
@@ -668,7 +669,7 @@ When using `useInfiniteQuery`, you'll notice a few things are different:
668669

669670
### Example
670671

671-
Let's assume we have an API that returns pages of `projects` 3 at a time based on a `cursor` index along with a cursor that can be used to fetch the next group of projects
672+
Let's assume we have an API that returns pages of `projects` 3 at a time based on a `cursor` index along with a cursor that can be used to fetch the next group of projects:
672673

673674
```js
674675
fetch('/api/projects?cursor=0')
@@ -769,7 +770,7 @@ function Projects() {
769770

770771
### What if I want to infinitely load more data in reverse?
771772

772-
Sometimes you may not want to **append** infintely loaded data, but instead **prepend** it. If this is case, you can use `fetchMore`'s `previous` option, eg.
773+
Sometimes you may not want to **append** infinitely loaded data, but instead **prepend** it. If this is case, you can use `fetchMore`'s `previous` option, eg.
773774

774775
```js
775776
fetchMore(previousPageVariables, { previous: true })
@@ -788,7 +789,7 @@ If you ever want to disable a query from automatically running, you can use the
788789
When `enabled` is `false`:
789790

790791
- If the query has cached data
791-
- The query will initialized in the `status === 'success'` or`isSuccess === true` state.
792+
- The query will be initialized in the `status === 'success'` or `isSuccess === true` state.
792793
- If the query does not have cached data
793794
- The query will start in the `status === 'idle'` or `isIdle === true` state.
794795
- The query will not automatically fetch on mount.
@@ -847,7 +848,7 @@ You can configure retries both on a global level and an individual query level.
847848
```js
848849
import { useQuery } from 'react-query'
849850

850-
// Make specific query retry a certain number of times
851+
// Make a specific query retry a certain number of times
851852
const queryInfo = useQuery(['todos', 1], fetchTodoListPage, {
852853
retry: 10, // Will retry failed requests 10 times before displaying an error
853854
})
@@ -998,7 +999,8 @@ function Todos() {
998999
}
9991000
```
10001001
1001-
> NOTE: Similar to `initialData`, `initialStale` can also be a function for costly calculations, eg. `initialStale: () => isPreview(todoListPreview)`,
1002+
> NOTE: Similar to `initialData`, `initialStale` can also be a function for costly calculations.
1003+
> eg. `initialStale: () => isPreview(todoListPreview)`
10021004
10031005
## SSR & Initial Data
10041006

0 commit comments

Comments
 (0)