title: Redux ToolKit Query - Make multiple queries in the same component dependant on each other
body: <p>I'm trying to use RTK Query in a NextJS app to fetch multiple entities from an API. I have the <code>App</code> and <code>AppVersion</code> models. When the component loads I need to fetch the <code>App</code> and then fetch the appropriate <code>AppVersion</code>s. An <code>App</code> has the <code>currentVersionId</code> property that links to and <code>AppVersion</code>.</p>
  <p>The code fails because the component is rendered without the router at first, it can't get an app and there's no <code>app.currentversionId</code>.</p>
  <p>I have two slices that fetch the appropriate objects from a RESTful API.</p>
  <pre class="lang-js prettyprint-override"><code>function AppsShow() {
    const router = useRouter()
    const { id } = router.query
    const { data: app } = useGetAppQuery(parseInt(id, 10)) // from RTK Query slice
    const currentVersion = useGetVersionQuery(app?.currentVersionId) // from RTK Query slice
  
    return (
      &lt;div&gt;&lt;/div&gt;
    )
  }
  
  </code></pre>
  <p>What is the appropriate pattern to use here?
  Thank you!</p>