mars/heroku-cra-node

Question: Why a separate react app?

PrincipalsOffice opened this issue · 1 comments

Hi I am still learning React so this question might seem trivial, I wonder is there a way to integrate the react app into the node server? Or is it a common practice for using react in the frontend?

mars commented

React runs in web browsers. Node runs on the server-side. The "separate React app" is the javascript bundle that is built/minified for delivery to the web browser via the Node server.

React does support server-side rendering too, which generates static HTML/CSS in Node before sending it to the browser. For these universal javascript apps, that server-generated static HTML helps with initial load performance, provides static content to robots (like Facebook's crawler & many search engines), and may improve accessibility for people on really old hardware or really slow connections. The create-react-app CLI tool does not provide server-side rendering; for that, I recommend Next.js on Heroku which provides elegant server-side React rendering & page-level abstraction for building the UI.