Skip to content

Instantly share code, notes, and snippets.

@hoffination
Created February 6, 2018 20:26
Show Gist options
  • Save hoffination/2ce6d9c65751edafe508a35edc8b28b6 to your computer and use it in GitHub Desktop.
Save hoffination/2ce6d9c65751edafe508a35edc8b28b6 to your computer and use it in GitHub Desktop.
Server rendering with React
const renderApp = () => {
const html = renderToString(React.createFactory(App)({ welcome: 'Hello' }))
return `
<!DOCTYPE html>
<html>
<head>
<title>Server rendered app</title>
</head>
<body>${html}</body>
</html>
`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment