react-dynamic-route-loading-es6 icon indicating copy to clipboard operation
react-dynamic-route-loading-es6 copied to clipboard

Server Side rendering example?

Open tconroy opened this issue 9 years ago • 2 comments

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.

tconroy avatar Aug 09 '16 18:08 tconroy

Thanks @tconroy. I fully agree. Let's see if we can have someone help out

grgur avatar Nov 14 '16 10:11 grgur

@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))
  }
}

jfresco avatar Oct 18 '17 02:10 jfresco