Skip to content

Commit 5ec72b5

Browse files
committed
docs: update README
1 parent 51749fc commit 5ec72b5

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Jotai Query 🚀 👻
22

3-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/01_typescript)
4-
53
[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.
64

75
# Table of contents
@@ -77,6 +75,8 @@ The second optional `getQueryClient` parameter is a function that return [QueryC
7775

7876
### atomWithQuery usage
7977

78+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/01_query)
79+
8080
`atomWithQuery` creates a new atom that implements a standard [`Query`](https://tanstack.com/query/v5/docs/react/guides/queries) from TanStack Query.
8181

8282
```jsx
@@ -104,7 +104,9 @@ const UserData = () => {
104104

105105
### atomWithQueries usage
106106

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+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](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).
108110

109111
There are two ways to use `atomWithQueries`:
110112

@@ -201,6 +203,8 @@ const CombinedUsersData = () => {
201203

202204
### atomWithInfiniteQuery usage
203205

206+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/03_infinite)
207+
204208
`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).
205209

206210
> 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 = () => {
245249

246250
### atomWithMutation usage
247251

252+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/05_mutation)
253+
248254
`atomWithMutation` creates a new atom that implements a standard [`Mutation`](https://tanstack.com/query/v5/docs/guides/mutations) from TanStack Query.
249255

250256
> 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.
298304

299305
### atomWithSuspenseQuery usage
300306

307+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/02_suspense)
308+
301309
```jsx
302310
import { atom, useAtom } from 'jotai'
303311
import { atomWithSuspenseQuery } from 'jotai-tanstack-query'
@@ -320,6 +328,8 @@ const UserData = () => {
320328

321329
### atomWithSuspenseInfiniteQuery usage
322330

331+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/jotaijs/jotai-tanstack-query/tree/main/examples/04_infinite_suspense)
332+
323333
```jsx
324334
import { atom, useAtom } from 'jotai'
325335
import { atomWithSuspenseInfiniteQuery } from 'jotai-tanstack-query'
@@ -457,10 +467,7 @@ $ yarn add @tanstack/react-query-devtools
457467
All you have to do is put the `<ReactQueryDevtools />` within `<QueryClientProvider />`.
458468

459469
```tsx
460-
import {
461-
QueryClient,
462-
QueryCache,
463-
} from '@tanstack/react-query'
470+
import { QueryClient, QueryCache } from '@tanstack/react-query'
464471
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
465472
import { QueryClientProvider } from 'jotai-tanstack-query/react'
466473
import { queryClientAtom } from 'jotai-tanstack-query'

0 commit comments

Comments
 (0)