What Is Node.Js

What exactly is node.js used for?

From Node.js website

Node.js is a platform built on Chrome's JavaScript runtime for easily
building fast, scalable network applications. Node.js uses an
event-driven, non-blocking I/O model that makes it lightweight and
efficient, perfect for data-intensive real-time applications that run
across distributed devices.

Event-driven means that the server only reacts when an event occurs. This allow us to create high performance, highly scalable, “real-time” applications.

Finally, this is probably the best article that will get you excited about Node.js

What is the role of Node.js in React-Native?

There are four types of JavaScript you'll write in todays environments:

1) Clientside browser JavaScript:

That's what gets sent to webbrowsers when they visit your webpage, it then gets executed in the browser at the clientside. As you want the JS to load fast and run on all kinds of browsers, you usually use transpilers to turn the modern ESnext you write into a minified version with better support.

2) Clientside native JavaScript:

Most devices do have a native JS runtime, therefore you can ship JS files with your Android / iOS / Desktop application and then start them there. These engines also support adding hooks from JavaScript into your native code, that's how React Native does provide it's APIs.

3) Serverside NodeJS JavaScript:

NodeJS is a runtime you'll use to run servers.

4) Buildscripts running on NodeJS:

You can use JavaScript to generate JavaScript files. That's how you bundle the files for (1) and (2) (maybe also (3)).

Now metro is a serverside buildscript (on NodeJS) that you can use to either a) start a server that serves your JS as a webpage (1 & 3), or b) that bundles your JS in a native App that you can install on your device (2).

The role of Node.js in RN is to only access npm and manage the packages?

No. metro is itself a package that you then run on NodeJS.

What is the node.js and its purpose?

  1. Node.js is a platform for the JavaScript language that is centered around asynchronous network programming. It contains a set of libraries to help you develop server-side applications with JavaScript

  2. Under the hood, Node.js is running on V8, a JavaScript engine developed by Google.

Hope this helps.

Why Node.js is called a JavaScript runtime built ?

See what my understanding​ calls runtime as is below:

Chrome's javascript runtime = google's V8 engine​.

V8 = JS runtime

Nodejs = V8 (i.e your js runtime) + web apis(for operations not present in V8 codebase) + task queue(for async stuff)

What JS runtime(V8) is : it provides memory allocation using heap and maintains a stack which is supposed to orderize the list of Operations​ to be performed as. instructed by code.

Every binding is done at runtime ( at the time of execution ) and at the core if Nodejs is V8 ( JS runtime)
V8 provides the run-time for JavaScript
.
Might help you.

What is Node.js?