Skip to content

Commit c987abc

Browse files
authored
docs: Update streamedQuery.md
1 parent b13f0b8 commit c987abc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/reference/streamedQuery.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ title: streamedQuery
55

66
`streamedQuery` is a helper function to create a query function that streams data from an [AsyncIterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator). Data will be an Array of all the chunks received. The query will be in a `pending` state until the first chunk of data is received, but will go to `success` after that. The query will stay in fetchStatus `fetching` until the stream ends.
77

8+
To see `streamedQuery` in action, take a look at our [chat example](../framework/react/examples/chat/react/nextjs-app-prefetching).
9+
810
```tsx
11+
import { experimental_streamedQuery as streamedQuery } from '@tanstack/react-query'
12+
913
const query = queryOptions({
1014
queryKey: ['data'],
1115
queryFn: streamedQuery({
@@ -14,6 +18,8 @@ const query = queryOptions({
1418
})
1519
```
1620

21+
> Note: `streamedQuery` is currently marked as `experimental` because we want to gather feedback from the community. If you've tried out the API and have feedback for us, please provide it in this [GitHub discussion](https://github.com/TanStack/query/discussions/9065).
22+
1723
**Options**
1824

1925
- `queryFn: (context: QueryFunctionContext) => Promise<AsyncIterable<TData>>`

0 commit comments

Comments
 (0)