T
TanStack3y ago
inland-turquoise

How to implement a request is dependent on data from another request?

If a request is dependent on data from another request, should a useQuery call go inside another queryFn with a relevant queryKey that will be passed through to the nested useQuery call?
1 Reply
wise-white
wise-white3y ago
Hi. No, you can't to nest useQueries or use them outside of setup . https://tanstack.com/query/v4/docs/guides/dependent-queries
Dependent Queries | TanStack Query Docs
Dependent (or serial) queries depend on previous ones to finish before they can execute. To achieve this, it's as easy as using the enabled option to tell a query when it is ready to run: `tsx

Did you find this page helpful?