QueriesObserver
#
The QueriesObserver
can be used to observe multiple queries.
1const observer = new QueriesObserver(queryClient, [
2 { queryKey: ['post', 1], queryFn: fetchPost },
3 { queryKey: ['post', 2], queryFn: fetchPost },
4])
5
6const unsubscribe = observer.subscribe((result) => {
7 console.log(result)
8 unsubscribe()
9})
Options
The options for the QueriesObserver
are exactly the same as those of useQueries
.