|
Download react-query/docs/reference/InfiniteQueryObserver.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 693 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/reference/InfiniteQueryObserver.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/reference/InfiniteQueryObserver.md
-
curl -L -o InfiniteQueryObserver.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/reference/InfiniteQueryObserver.md
693 Bytes
| id: InfiniteQueryObserver | |
| title: InfiniteQueryObserver | |
| ## `InfiniteQueryObserver` | |
| The `InfiniteQueryObserver` can be used to observe and switch between infinite queries. | |
| ```tsx | |
| const observer = new InfiniteQueryObserver(queryClient, { | |
| queryKey: ['posts'], | |
| queryFn: fetchPosts, | |
| getNextPageParam: (lastPage, allPages) => lastPage.nextCursor, | |
| getPreviousPageParam: (firstPage, allPages) => firstPage.prevCursor, | |
| }) | |
| const unsubscribe = observer.subscribe((result) => { | |
| console.log(result) | |
| unsubscribe() | |
| }) | |
| ``` | |
| **Options** | |
| The options for the `InfiniteQueryObserver` are exactly the same as those of [`useInfiniteQuery`](../../framework/react/reference/useInfiniteQuery). | |