Before I began migrating my Express with Pug (the template/view engine) to a server side rendered React app, I wish somebody told me this one thing:
“For anything that is going to show HTML, you are always going to make sure that React Router is in charge of making that request”
This one line of spoken word would have saved me in excess of 20 hours.
Anyway, now I’m learning how to do things properly by watching this course. The main takeaway here is that you cannot server side render react components based on Express routing. It just doesn’t work. Express routes need to explicitly cover one-off routes that cover routing logic such as outside requests, API handlers, or handlers that return JSON. The rest, as they say, is React.