mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
example with-apollo note that two render executions are expected (#5262)
Noting per https://github.com/zeit/next.js/issues/5050 for new users of Apollo that they should not be concerned about multiple renders.
This commit is contained in:
parent
7ebcc5bec9
commit
48d54c254f
|
@ -51,3 +51,7 @@ In this simple example, we integrate Apollo seamlessly with Next by wrapping our
|
|||
On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.
|
||||
|
||||
This example relies on [graph.cool](https://www.graph.cool) for its GraphQL backend.
|
||||
|
||||
|
||||
Note: Do not be alarmed that you see two renders being executed. Apollo recursively traverses the React render tree looking for Apollo query components. When it has done that, it fetches all these queries and then passes the result to a cache. This cache is then used to render the data on the server side (another React render).
|
||||
https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree
|
||||
|
|
Loading…
Reference in a new issue