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: README.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# Jotai Query 🚀 👻
2
2
3
-
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/01_typescript)
4
-
5
3
[jotai-tanstack-query](https://github.com/jotai-labs/jotai-tanstack-query) is a Jotai extension library for TanStack Query. It provides a wonderful interface with all of the TanStack Query features, providing you the ability to use those features in combination with your existing Jotai state.
6
4
7
5
# Table of contents
@@ -77,6 +75,8 @@ The second optional `getQueryClient` parameter is a function that return [QueryC
77
75
78
76
### atomWithQuery usage
79
77
78
+
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/01_query)
79
+
80
80
`atomWithQuery` creates a new atom that implements a standard [`Query`](https://tanstack.com/query/v5/docs/react/guides/queries) from TanStack Query.
81
81
82
82
```jsx
@@ -104,7 +104,9 @@ const UserData = () => {
104
104
105
105
### atomWithQueries usage
106
106
107
-
`atomWithQueries` creates a new atom that implements parallel queries from TanStack Query. It allows you to run multiple queries concurrently and optionally combine their results.
107
+
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/07_queries)
108
+
109
+
`atomWithQueries` creates a new atom that implements `Dynamic Parallel Queries` from TanStack Query. It allows you to run multiple queries concurrently and optionally combine their results. You can [read more about Dynamic Parallel Queries here](https://tanstack.com/query/v5/docs/framework/react/guides/parallel-queries#dynamic-parallel-queries-with-usequeries).
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/03_infinite)
207
+
204
208
`atomWithInfiniteQuery` is very similar to `atomWithQuery`, however it is for an `InfiniteQuery`, which is used for data that is meant to be paginated. You can [read more about Infinite Queries here](https://tanstack.com/query/v5/docs/guides/infinite-queries).
205
209
206
210
> Rendering lists that can additively "load more" data onto an existing set of data or "infinite scroll" is also a very common UI pattern. React Query supports a useful version of useQuery called useInfiniteQuery for querying these types of lists.
@@ -245,6 +249,8 @@ const Posts = () => {
245
249
246
250
### atomWithMutation usage
247
251
252
+
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/05_mutation)
253
+
248
254
`atomWithMutation` creates a new atom that implements a standard [`Mutation`](https://tanstack.com/query/v5/docs/guides/mutations) from TanStack Query.
249
255
250
256
> Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
@@ -298,6 +304,8 @@ jotai-tanstack-query can also be used with React's Suspense.
298
304
299
305
### atomWithSuspenseQuery usage
300
306
307
+
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/02_suspense)
[](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/04_infinite_suspense)
0 commit comments