Closed gmchaturvedi1 closed 6 years ago
Please clone/download this repo in a clean directory, then follow the instruction in the README file:
yarn install
yarn run build
yarn run server
You need to run the server app with yarn run server
. Running just yarn start
will not work because __SERVER_REDUX_STATE__
is not overwritten by the node server (yarn start
is not running the node server!), so you'll get at least an error for undefined variable.
Please read the articles linked in the README file. As clearly explained there, __SERVER_REDUX_STATE__
is just a placeholder that the express app has to overwrite. Of course, you'll get an error if you just run the app without the server, because window.__REDUX_STATE__ = __SERVER_REDUX_STATE__
is not valid.
Again, this repo is not for react development, but just to demonstrate how SSR and code-splitting can be achieved!