title: apollo-client in next.js with `next-with-apollo` VS the approach shown in next.js docs FAQ (no use of `getDataFromTree`)
body: <p><strong>Contrast in &quot;apollo-client in next.js&quot; approaches chosen in <code>next-with-apollo</code> npm library and <a href="https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js" rel="nofollow noreferrer">the approach shown in next.js docs</a>.</strong></p>
  <p>The link of approach chosen by next.js for apollo client: <a href="https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js" rel="nofollow noreferrer">https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js</a></p>
  <p><strong><a href="https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js" rel="nofollow noreferrer">In next.js doc approach</a>:</strong></p>
  <ul>
  <li>no third-party library next-with-apollo is used</li>
  <li>no get-data-from-tree is used</li>
  <li>Moreover i found this approach more meaningful and elegant inner-working of client side redering and SSR of apollo-client in next.js. I strongly like this</li>
  </ul>
  <p><strong>Some cons in <code>next-with-apollo</code> approach</strong></p>
  <ul>
  <li>in next-with-apollo docs, it is stated that in withApollo API, the parameter getDataFromTree of intialState defaults to undefined by implementaion and its stated &quot;It's recommended to never set this prop, otherwise the page will be a lambda without Automatic Static Optimization &quot;</li>
  <li>get-initial-props is used which is not recommended by next.js for optimization reasons
  general thing. Why to consider third party library if there is non-third party way and suggested officially unless it has drawbacks?</li>
  </ul>
  <p>It made me really curious to see many are using <code>next-with-apollo</code> and rarely seen the usage of the <a href="https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js" rel="nofollow noreferrer">approach shown in next.js docs</a>? I'm curious whether approach in next.js docs has any drawbacks (which i strong think of not having any)?</p>
  <ul>
  <li>does the approach shown in next.js has some drawbacks?</li>
  <li>does next-with-apollo has more efficiencies? if so what r those more efficiencies for which it is wise not to choose next.js doc approach. I wanna be sure that if i'm rejecting next.js doc approach (currently im choosing it) i'm not doing any wrong</li>
  </ul>
  <p><strong>So which is better for both client-side data fetching and server-data fetching to support both CSR and SRR?</strong></p>