title: Dependant queries with react-query to map a new array from two data sources
body: <p>I have two <code>usePaginatedQuery</code> hooks with one dependent on the other.</p>
  <p>The first is:</p>
  <pre><code>  const {
      resolvedData: policies,
      isLoading: isLoadingPolicies,
      isError: isErrorPolicies,
      refetch: refetchPolicies,
    } = policyService.usePolicies({ page: pageIndex, enabled: true });
  </code></pre>
  <p>This gives me back an array of ids that i need for the second query:</p>
  <pre><code>  const {
      resolvedData: documents,
      isFetching: isFetchingDocuments,
      refetch: refetchDocuments,
    } = policyService.usePolicyDocuments({
      policyReference: id,
    });
  </code></pre>
  <p>the second returns a list of documents for the id in the first so i need to loop over the <code>policies</code> from the first to get he id to pass as a param for the second which should result in an array like so:</p>
  <p><code>[{policyReference: 'a', document: '1.txt'}, {policyReference: 'a', document: '2.txt'}, {policyReference: 'b', document: '3.txt'}]</code></p>
  <p>And so on for all the documents in all the policies.</p>
  <p>Is there a way to do this in <code>react-query</code>?</p>
  <p>I read the docs for dependant queries but I am stil not sure how to work it for this situation?</p>