ReactJS vs NodeJS – Why do I need to create both?

I understand that React is frontend, and NodeJS is the backend that allows Javascript code to function outside of a browser. What I don’t understand (and this is after following tutorials online on setting up a React project and a NodeJS project) is why I have to create an instance of each.

For example, in my React project, I managed to create a website. But because I needed a backend, I decided to use NodeJS. But I’m doing NodeJS tutorials, and I can create a website using NodeJS too. I’m confused because right now, it’s appearing to be that React and NodeJS do theĀ SAME THING.

I have never worked with NodeJS before so I am a bit confused. I was under the impression that I would just use NodeJS to host the backend, but after seeing that I’m literally having to create an entire website with NodeJS, I don’t understand how I’m supposed to use React and NodeJS together.

How do the two, React and NodeJS, integrate together to create a fully-functioning web app? I have yet to see something online that clearly breaks down how the two interact.

Good Asked on April 27, 2021 in Website.
Add Comment
  • 1 Answer(s)

    React is front-end library. It provides great tooling for creatiing user interfaces. And it creates a single page application. Which means when you open a react app. It does not reload and its really fast.

    While you could also use nodejs and something like handlebars to create a website. But that website would be rendered on server and then served to the user. But its alot more than that. There are a lot of things that you want to do on the server. Like authentication. You want that part to be secure. So you keep it on the server.

    Now the answer to the final part of your question.

    For a fully functional app. You would use react to create user interfaces. And nodejs for creating an API which your react app will call.

    Best Answered on April 27, 2021.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.