TanStackT
TanStack3y ago
2 replies
dry-scarlet

reusing useQuery

I have a general hook that uses useQuery to fetch some data. I had a new use case in which i want to access the data returned from this query in a different place in my code.

I want to avoid using queryClient.getQueryData as it will not trigger a refresh when the data changes. So i tried calling the query like this

useQuery([key])

However, it gives me an error saying "missing queryFn". is it the case that I need always to pass my queryFn?
Was this page helpful?