Home>Article>Web Front-end> What is the difference between node and react
The difference between node and react is: nodejs is a platform based on the Chrome JavaScript runtime, which can be used to easily build web applications with fast response and easy expansion; while react is a platform used to build user interfaces JavaScript library, mainly used for building UI.
The operating environment of this tutorial: windows10 system, react17.0.1&&nodejs version 12.19.0, Dell G3 computer.
The biggest difference between nodejs and react framework is: nodejs is a platform based on Chrome JavaScript runtime. And react is a JavaScript library for building user interfaces.
It can be seen that the two are not on the same level at all. Node.js allows you to run JS things outside the browser, which is equivalent to a JS interpreter (equivalent to a JVM). React is a JS library that has many functions for you to use, so you don’t have to write them yourself, but the prerequisite is that you need to know these functions and know their correct usage.
You don’t have to use Node when using React, because react is just a JS library. It is a JS source code file. You can directly introduce it into the HTML file and use it directly. The reason why node is used is because generally speaking, you have to use React to write the front end. Using the React library alone is not enough. You also need peripheral tools, and these tools are run outside the browser, such as unit testing. library, and then you have to use node.
Node.js:
Node.js is a platform built on the Chrome JavaScript runtime.
Node.js is an event-driven I/O server-side JavaScript environment based on Google's V8 engine. The V8 engine executes Javascript very quickly and has very good performance.
node.js can be used to easily build web applications with fast response speed and easy expansion. Node uses an event-driven, non-blocking I/O model to be lightweight and efficient, making it ideal for running data-intensive real-time applications on distributed devices.
NodeJS is very active on the server side, and a large number of Web services based on NodeJS have appeared. On the other hand, NodeJS has made the front-end a magical tool. It can finally extend its capabilities beyond the browser window, and a large number of front-end tools have sprung up.
Therefore, for the front end, although not everyone has to write a server program with NodeJS, it can be as simple as using command interactive mode to debug JS code snippets, or as complex as writing tools to improve work efficiency
Advantages of nodejs:
1. Asynchronous event-driven
2. Non-blocking I/O
3. Single thread (here refers to Main thread)
4. Outstanding performance
#React:
React is a JAVASCRIPT library for building user interfaces.
React is mainly used to build UI. Many people think that React is the V (view) in MVC.
React originated as an internal project at Facebook to build the Instagram website and was open sourced in May 2013.
React has high performance and very simple code logic. More and more people have begun to pay attention to and use it.
React is a JavaScript framework for building "predictable" and "declarative" web user interfaces, and it has enabled Facebook to develop web applications faster.
Features of React
1. Declarative design −React adopts a declarative paradigm, which makes it easy to describe applications.
2. Efficiency −React minimizes interaction with the DOM by simulating the DOM.
3. Flexible −React works well with known libraries or frameworks.
4.JSX − JSX is an extension of JavaScript syntax. JSX is not required for React development, but it is recommended.
5. Components − Building components through React makes it easier to reuse code and can be well applied in the development of large projects.
6. One-way response data flow − React implements one-way response data flow, thereby reducing duplicate code, which is why it is simpler than traditional data binding.
Recommended learning: "nodejs video tutorial"
The above is the detailed content of What is the difference between node and react. For more information, please follow other related articles on the PHP Chinese website!