Skip to content

Commit

Permalink
Clarify usage of getDataFromTree vs. renderToStringWithData (apol…
Browse files Browse the repository at this point in the history
  • Loading branch information
DanForys committed Jul 13, 2021
1 parent bc86a32 commit 5e5030c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/performance/server-side-rendering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ Because our app uses Apollo Client, some of the components in the React tree pro
This function walks down the entire tree and executes every required query it encounters (including nested queries). It returns a `Promise` that resolves when all result data is ready in the Apollo Client cache.

When the `Promise` resolves, you're ready to render your React tree and return it, along with the current state of the Apollo Client cache.

> Note that if you are rendering your React tree directly to a string (instead of the component-based example below), you will need to use [`renderToStringWithData`](https://www.apollographql.com/docs/react/api/react/ssr/#rendertostringwithdata) instead of `getDataFromTree`. This will ensure the client-side React hydration works correctly by using [`ReactDOMServer.renderToString`](https://reactjs.org/docs/react-dom-server.html#rendertostring) to generate the string.
The following code replaces the `TODO` comment within the `app.use` call in the example above:

Expand Down

0 comments on commit 5e5030c

Please sign in to comment.