Selective server-side rendering with data
When we developed the frontend of the base skeleton application in Chapter 4, Adding a React Frontend to Complete MERN, we integrated basic server-side rendering to be able to load client-side routes directly from the browser address bar when the request goes to the server. In this SSR implementation, while rendering the React components server-side, we did not consider loading the data from the database for the components that displayed data. The data only loads in these components when the client-side JavaScript takes over after the initial load of the server-side rendered markup.
We did update this implementation to add server-side rendering with data for the individual media detail pages in the MERN Mediastream application discussed in Chapter 9, Customizing Media Player and Improve SEO. In this case, we decided to render this specific view with data by injecting data into the server-side generated markup of the React frontend. The reasoning behind...