title: Does useQuery run on server-side rendering?
body: <p>I'm new to Nextjs and have some questions about client-side rendering and server-side rendering in Nextjs</p>
  <ol>
  <li>I see there are two ways to fetched data on Nextjs. One of them is to use <code>useQuery</code> hook but only callable on React component function. Does it mean that it only running when rendering the page from the client-side</li>
  <li>I read a post about how to connect <code>apolloClient</code> to Nextjs. It said that</li>
  </ol>
  <blockquote>
  <p>always create a new instance of <code>apolloClient</code> for SSR and only create one instance of <code>apolloClient</code> for CSR</p>
  </blockquote>
  <p>Here is the example code</p>
  <pre><code>  export function initializeApollo(initialState = null) {
      const _apolloClient = apolloClient ?? createApolloClient();
  
      // If your page has Next.js data fetching methods that use Apollo Client,
      // the initial state gets hydrated here
      if (initialState) {
        // Get existing cache, loaded during client side data fetching
        const existingCache = _apolloClient.extract();
  
        // Restore the cache using the data passed from
        // getStaticProps/getServerSideProps combined with the existing cached data
        _apolloClient.cache.restore({ ...existingCache, ...initialState });
      }
  
      // For SSG and SSR always create a new Apollo Client
      if (typeof window === &quot;undefined&quot;) return _apolloClient;
  
      // Create the Apollo Client once in the client
      if (!apolloClient) apolloClient = _apolloClient;
      return _apolloClient;
    }
  
  </code></pre>
  <p>Can anyone explain that? I'm sorry if the question are silly</p>