With server-side rendering, we always need to keep in mind that our React code will be executed in the browser and on the server:
- Ensure that you do not use the window, location, history, and document objects—it is not possible to access these on the server.
- Use the best practices of Redux/React—do not use the global scope, keep your components self-sustaining, and do not directly manipulate the DOM.
- Ensure that your code does not have any memory leaks. This is already a problem, even without server-side rendering, but having a memory leak in the server, with potentially limited resources and high load, will be an even bigger problem.
- Ensure that the third-party libraries you use work on the server. Libraries that work on both the client and the server are called universal or isomorphic.