title: Recommended way to use GraphQL in Next.js app
body: <p>In my apps, I am using following <strong>NPM modules</strong> to play with <a href="https://strapi.io/" rel="noreferrer">Strapi</a>, <a href="https://graphql.org/" rel="noreferrer">GraphQL</a> and <a href="https://nextjs.org/" rel="noreferrer">Next.js</a>:</p>
  
  <ul>
  <li><a href="https://www.npmjs.com/package/react-apollo" rel="noreferrer">react-apollo</a></li>
  <li><a href="https://www.npmjs.com/package/next-apollo" rel="noreferrer">next-apollo</a></li>
  <li><a href="https://www.npmjs.com/package/graphql" rel="noreferrer">graphql</a></li>
  <li><a href="https://www.npmjs.com/package/gql" rel="noreferrer">gql</a> </li>
  <li><a href="https://www.npmjs.com/package/recompose" rel="noreferrer">recompose</a></li>
  </ul>
  
  <p>In the next step, I am creating Apollo config file, example below:</p>
  
  <pre><code>import { HttpLink } from "apollo-link-http";
  import { withData } from "next-apollo";
  
  const config = {
    link: new HttpLink({
      uri: "http://localhost:1337/graphql",
    })
  };
  export default withData(config);
  </code></pre>
  
  <p>and then inside a class component, I am using a static method <code>getInitialProps()</code> to fetch data from the Strapi via GraphQL query.</p>
  
  <p>Everything is fine but maybe there is another, better way via React hooks or any other? </p>