Created
February 20, 2017 15:21
-
-
Save diegocasmo/11ccf1ec1815912b5a3c546a6a9c8ae7 to your computer and use it in GitHub Desktop.
This file has an Express handler to catch all routes and isomorphically serve the application using React's renderToString method. Notice appData is passed to both the Provider and the index template.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res.render('index', { | |
renderedRoot: ReactDOMServer.renderToString( | |
<Provider appData={appData}> | |
<RouterContext {...props}/> | |
</Provider> | |
), | |
appData: appData | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment