Open History to see the last commit
1---
2id: QueryObserver
3title: QueryObserver
4---
5β
6The `QueryObserver` can be used to observe and switch between queries.
7β
8```tsx
9const observer = new QueryObserver(queryClient, { queryKey: ['posts'] })
10β
11const unsubscribe = observer.subscribe((result) => {
12 console.log(result)
13 unsubscribe()
14})
15```
16β
17**Options**
18β
19The options for the `QueryObserver` are exactly the same as those of [`useQuery`](../../framework/react/reference/useQuery).