I am very new to Reactjs, I have encountered this problem while I am learning react, What are nodes in reactjs, and how nodes are useful in reactjs and why we have to use them? Explain me in simple real time scenarios.
-
Share with us in which contex you encountered with the term "nodes" – Dennis Vash Jul 04 '19 at 13:15
-
I believe there's a bit of confusion. ReactJS is a Frontend framework, while NodeJS is a Backend framework. – Michele Jul 04 '19 at 13:16
-
Hi Dennis Vash, Please go through these two links then you will now what I am asking thanks for your reply. https://www.reactenlightenment.com/react-nodes/4.1.html , https://stackoverflow.com/questions/31556450/what-is-mounting-in-react-js – Vamsi Jul 04 '19 at 13:29
-
Hi Michele, I know Nodejs is a JavaScript framework, But in my question I am not asking about Nodejs. I am asking about what are nodes not nodejs. please go through these links once https://www.reactenlightenment.com/react-nodes/4.1.html https://stackoverflow.com/questions/31556450/what-is-mounting-in-react-js – Vamsi Jul 04 '19 at 13:48
-
The manual you link to has several chapters explaining in depth what the nodes are, how they work and what they do. What part of the manual is unclear? – JJJ Jul 04 '19 at 14:00
2 Answers
React nodes are basically equivalent to DOM nodes. To simplify, we can just talk about them as generic 'nodes.'
A node is the basic building block of a web page. All HTML elements (div
, a
, p
) are nodes, as well as document
, text, attributes...
You can create these nodes as separate entities, and then organize them into a tree (the DOM) in a parent-child hierarchy. document
is the root, and then any nodes you add as children will be added to the page. W3Schools has a basic diagram here: https://www.w3schools.com/js/js_htmldom_navigation.asp
Part of what makes React fast is that is builds a virtual DOM, and then compares the actual DOM with the virtual DOM to replace only the nodes which have changed since the previous render. But conceptually, React nodes and DOM nodes are equivalent.
See this answer as well: What is a node in Javascript?
And the MDN docs for node
:https://developer.mozilla.org/en-US/docs/Web/API/Node

- 6,264
- 3
- 19
- 32
The primary type or value that is created when using React is known as a React node.
React nodes are not real DOM nodes (like element, text or attribute nodes) themselves, but a representation of a virtual DOM. In a nutshell, React is used to define a virtual DOM using React nodes, that fuel React components, that can eventually be used to create a real DOM structured or other structures. We can create React nodes using JSX or JavaScript

- 51
- 8
-
Learn about nodes in JavaScript here https://www.tutorialstonight.com/what-is-a-node-in-javascript.php – Ikram Ul Haq Apr 15 '22 at 10:59