Guest User

Untitled

a guest
Dec 9th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import { renderToStringWithData } from "react-apollo"
  2.  
  3. const client = new ApolloClient(...);
  4.  
  5. renderToStringWithData(App).then((content) => {
  6. const initialState = client.extract();
  7. const html = <Html content={content} state={initialState} />;
  8.  
  9. res.status(200);
  10. res.send(`<!doctype html>\n${ReactDOM.renderToStaticMarkup(html)}`);
  11. res.end();
  12. });
Add Comment
Please, Sign In to add comment