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/src/pages/guides/migrating-to-react-query-3.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -416,6 +416,37 @@ setConsole({
416
416
417
417
In version 3 **this is done automatically when React Query is used in React Native**.
418
418
419
+
420
+
### Typescript
421
+
#### `QueryStatus` has been changed from an [enum](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums) to a [union type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
422
+
423
+
So, if you were checking the status property of a query or mutation against a QueryStatus enum property you will have to check it now against the string literal the enum previously held for each property.
424
+
425
+
Therefore you have to change the enum properties to their equivalent string literal, like this:
426
+
-`QueryStatus.Idle` -> `'idle'`
427
+
-`QueryStatus.Loading` -> `'loading'`
428
+
-`QueryStatus.Error` -> `'error'`
429
+
-`QueryStatus.Success` -> `'success'`
430
+
431
+
Here is an example of the changes you would have to make:
432
+
433
+
```diff
434
+
- import { useQuery, QueryStatus } from 'react-query';
Copy file name to clipboardExpand all lines: docs/src/pages/guides/paginated-queries.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ However, if you run this simple example, you might notice something strange:
13
13
14
14
**The UI jumps in and out of the `success` and `loading` states because each new page is treated like a brand new query.**
15
15
16
-
This experience is not optimal and unfortunately is how many tools today insist on working. But not React Query! As you may have guessed, React Query comes with an awesome featured called `keepPreviousData` that allows us to get around this.
16
+
This experience is not optimal and unfortunately is how many tools today insist on working. But not React Query! As you may have guessed, React Query comes with an awesome feature called `keepPreviousData` that allows us to get around this.
17
17
18
18
## Better Paginated Queries with `keepPreviousData`
0 commit comments