Ask coding questions

← Back to all posts
How do I use Node.js with React.js?
Martin025 (3)

Hi.
I would like to create a web app with a Node.js backend and a React.js frontend. I have heard of things like Next.js (not really what I'm looking for), and Replit's React-Express template, but when I open the website on my computer the React.js devtools extension says the page is not using React. I think this is because the code is being converted into HTML before the page is rendered, so I don't get the full functionality of React. So, is there a way to make a React web app with a Node.js backend?

Comments
hotnewtop
notGilbert (121)

First, you can use a toolchain (or not) like create-react-app to make your frontend app.

Then, you can build it, which will be made into static HTML, CSS, JS, and assets.

Lastly, set up your server and statically serve those files (rewrite non-api requests to the static files).

If you want a way to communicate between your app and the server, use HTTP requests or websockets.

CRA template - https://replit.com/@templates/Create-React-App