daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top