-
Maybe this is an error in the docs, or just me missing a point.
The only thing required is the However, in the docs for QueriesObserver , we need also the
And lastly, InfiniteQueryObserver apparently even requires
Does anyone know why we need different kind of parameters for each kind of observer? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
They don't, these are just examples. You can setup an observer with only the
basically, options you pass to an Observer are the same as you'd pass to |
Beta Was this translation helpful? Give feedback.
They don't, these are just examples. You can setup an observer with only the
queryKey
- that's the only required argument. But if you don't have aqueryFn
set globally then, it will die. So mostly, you'll needqueryKey
+queryFn
.useInfiniteQuery
mostly does nothing withoutgetNextPageParam
, and this will be required on type level in v5, as well as an additionaldefaultPageParam
option. You can read about that changes here:basically, options you pass to an Observer are the same as you'd pass to
useQuery
oruseQueries
/useInfiniteQuery
in react, because the react hooks create observers.