react-dynamic-route-loading-es6
react-dynamic-route-loading-es6 copied to clipboard
Server Side rendering example?
This medium post and this repo are the cleanest examples of code splitting I've found, so thank you!
One thing I'd like to request is an example of a server side implementation, where the initial state is set by the server and returned to the client with the appropriate bundles.
Thanks @tconroy. I fully agree. Let's see if we can have someone help out
@tconroy I could make SSR work by changing a little bit the getComponent functions. It works in my setup, I didn't try it in this project.
getComponent(location, cb) {
if (process.env.IS_BROWSER) {
System.import('pages/Home').then(loadRoute(cb)).catch(errorLoading);
} else {
cb(null, require('pages/Home').default))
}
}