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/react/community/suspensive-react-query.md
+16-8Lines changed: 16 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,22 @@ id: suspensive-react-query
3
3
title: Suspensive React Query
4
4
---
5
5
6
-
Typesafe useQuery, useInfiniteQuery with default suspense option.
6
+
Typesafe useQuery, useQueries, useInfiniteQuery with default suspense option.
7
7
8
-
Use @suspensive/react-query, delegate loading and error handling to the outside of the component with useSuspenseQueryand useSuspenseInfiniteQuery, and focus on success inside the component.
8
+
Use @suspensive/react-query, delegate loading and error handling to the outside of the component with [useSuspenseQuery](https://suspensive.org/docs/react-query/src/useSuspenseQuery.i18n), [useSuspenseQueries](https://suspensive.org/docs/react-query/src/useSuspenseQueries.i18n)and [useSuspenseInfiniteQuery](https://suspensive.org/docs/react-query/src/useSuspenseInfiniteQuery.i18n), and focus on success inside the component.
9
9
10
10
You don't even need to use the isSuccess flag.
11
11
12
12
## Installation
13
+
13
14
You can install @suspensive/react-query via [NPM](https://www.npmjs.com/package/@suspensive/react-query).
const query =useSuspenseQuery(queryKey, queryFn, options) // suspense:true is default.
61
+
const query =useSuspenseQuery({
62
+
queryKey,
63
+
queryFn,
64
+
}) // suspense:true is default.
59
65
60
66
// No need to do type narrowing by isSuccess
61
67
query.data// TData
@@ -66,4 +72,6 @@ const Example = () => {
66
72
67
73
Now, we can concentrate component as any fetching will be always success in component.
68
74
69
-
Check the complete documentation on [GitHub](https://github.com/suspensive/react).
75
+
### More Information
76
+
77
+
Check the complete documentation on [Suspensive Official Docs Site](https://suspensive.org/) and also welcome Pull Request on [Suspensive GitHub](https://github.com/suspensive/react)
Copy file name to clipboardExpand all lines: docs/react/guides/suspense.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -101,3 +101,7 @@ const App: React.FC = () => {
101
101
## Fetch-on-render vs Render-as-you-fetch
102
102
103
103
Out of the box, React Query in `suspense` mode works really well as a **Fetch-on-render** solution with no additional configuration. This means that when your components attempt to mount, they will trigger query fetching and suspend, but only once you have imported them and mounted them. If you want to take it to the next level and implement a **Render-as-you-fetch** model, we recommend implementing [Prefetching](../guides/prefetching) on routing callbacks and/or user interactions events to start loading queries before they are mounted and hopefully even before you start importing or mounting their parent components.
104
+
105
+
## Further reading
106
+
107
+
For tips on using suspense option, check the [Suspensive React Query Package](../community/suspensive-react-query) from the Community Resources.
0 commit comments