I want to load a query's data inside an async function
Hi all, I have a feature in my app where the user can print out a report, now inside the async function to print the report I want to access a query's data but I'm not sure how to do that, I have created a helper function which works but I'm not sure if this is a good way to do it
1 Reply
genetic-orange•2y ago
It's possible to get data directly from the queryClient. https://tanstack.com/query/latest/docs/react/reference/QueryClient The query client in both React Query and Angular Query are 100% identical so you can refer to the React Query docs on how to use it. In Angular you'd get the queryClient using
injectQueryClient
.QueryClient | TanStack Query Docs
QueryClient
The QueryClient can be used to interact with a cache: