Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { renderToStringWithData } from "react-apollo"
- const client = new ApolloClient(...);
- renderToStringWithData(App).then((content) => {
- const initialState = client.extract();
- const html = <Html content={content} state={initialState} />;
- res.status(200);
- res.send(`<!doctype html>\n${ReactDOM.renderToStaticMarkup(html)}`);
- res.end();
- });
Add Comment
Please, Sign In to add comment