Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the reason for using node in react

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the reason for the use of node in react". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the reason for using node in react".

Because webpack needs to be used in react, and webpack relies on nodejs;webpack as a module baler, it depends on nodejs when performing packaging compression, and webpack cannot be used without nodejs, so react needs to use nodejs.

The operating environment of this tutorial: Windows10 system, react17.0.1 version, Dell G3 computer.

Why to use node in react

The main reason for learning React to install nodejs is not that React depends on nodejs, but that webpack depends on nodejs.

Webpack relies on nodejs when performing packaging compression, and webpack cannot be used without nodejs. For example, if you want to use an electric lamp, you must first have an electric current, and the electric current needs an engine to generate electricity. You can't just use the electric current just because you say I don't want the engine.

Introduction to common tools

1 、 nodejs: Node.js ®is a JavaScript runtime built on Chrome's V8 JavaScript engine. How to understand? First, node.js is a JavaScript runtime environment. Generally speaking, JavaScript as we know it runs in a browser. So you can understand why it is based on Chrome's V8 JavaScript engine. With nodejs, you can abstract javascript common components and deploy them separately to nodejs to provide common services. The possibility of the front end has become more imaginative ever since.

2. Npm: (node package manager) node package manager, which mainly manages node package installation, uninstall, update, view, search and publish. Liberate developers from tedious package management (versions, dependencies). Nodejs has integrated npm, so npm is installed when you install nodejs.

3. Nvm:node version manager, which can easily install and maintain multiple versions of Node on the machine. So why do you need multiple versions? There are many scenarios, such as: you may be working on two projects at the same time, and different projects use different versions of node, or you may want to do some experiments with the newer version. In this case, it is also troublesome to install and maintain multiple versions of node without NVM. This is the value of nvm.

4. Webpack:webpack is a module bundler (webpack is a module baler). It is about analyzing the structure of your current project and putting things that the browsers in the project don't understand (SCSS, jade, Typescript, etc.), packaging it in an appropriate way and translating it into css and js that the browser can understand. In webpack, everything is a module (so are pictures, CSS).

Thank you for your reading, the above is "what is the reason for the use of node in react" content, after the study of this article, I believe you have a deeper understanding of what is the reason for the use of node in react, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report