A baseline for server side rendering for your React application
MIT License
This is no longer the recommended way to approach server side rendering with React. For an all-round solution look at a starter with next.js
or remix
Clone the repo with
git clone https://github.com/alexnm/react-ssr
Install dependencies with
npm i
Run dev mode with
npm run dev
Now open the browser and navigate to http://localhost:2048
and you get your server rendered React app. You can inspect the page source and see that the html coming from your local server has all the nodes defined in the React app.
index.js
file which is in the root folder. This file loads the babel-register and sets up the babel plugins needed to run JSX and ESModules on the server.dist
folder.client.js
because it's the only part of our application that is not used for the server render.Understand the different parts of server side rendering by going through each tag:
Read more about implementing server side rendering step by step. Feedback is more than welcome!