Last active
June 25, 2017 15:50
-
-
Save gregberge/272fc215c5db256493f6e731d0bd36a1 to your computer and use it in GitHub Desktop.
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
import React from 'react' | |
import { renderToString } from 'react-dom/server' | |
import { StaticRouter } from 'react-router' | |
import { getLoadableState } from 'loadable-components/server' | |
import App from './App' | |
const app = ( | |
<StaticRouter> | |
<App /> | |
</StaticRouter> | |
) | |
// Traversing React tree to load all modules | |
getLoadableState(app).then(() => { | |
const html = renderToString(<YourApp />) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment