Home >Web Front-end >Front-end Q&A >What framework does react belong to?
react belongs to a web front-end development framework; react is a JavaScript library used to build user interfaces. Its characteristics are: 1. Simple, simply express what your application should look like at any point in time; 2. Declaratively, React is about constructing reusable components. In fact, with React, all you do is build components. Through encapsulation, component code reuse, testing and separation of concerns are made easier.
The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.
What framework does react belong to?
react belongs to a web front-end development framework.
React is a JavaScript library used to build user interfaces. It originated from Facebook's internal project. The company was not satisfied with all the JavaScript MVC frameworks on the market and decided to develop its own one to build the Instagram website. Open sourced in May 2013.
So what problem does React solve? You can find this sentence on the official website:
We built React to solve one problem: building large applications with data that changes over time.
Build large-scale applications where data will change over time. To do this, React has two main features. :
Simple
Simple expression of what your application should look like at any point in time, React will automatically manage UI interface updates When the data changes.
Declarative
When the data changes, React is conceptually the same as clicking F5. In fact, it is just an update. It's just part of the change.
React is about building reusable components. In fact, with React all you do is build components. Encapsulation makes component code reuse, testing, and separation of concerns easier.
The main principles of React
Virtual DOM Virtual DOM
In traditional web applications, operating DOM is usually directly updated, but we know that DOM Updates are usually more expensive. In order to reduce operations on the DOM as much as possible, React provides a different and powerful way to update the DOM instead of direct DOM operations. It is Virtual DOM, a lightweight virtual DOM, which is an object abstracted by React, describing what the dom should look like and how it should be presented. The real DOM is updated through this Virtual DOM, and this Virtual DOM manages the update of the real DOM.
Why can it be faster through this extra layer of Virtual DOM operations? This is because React has a diff algorithm. Updating the Virtual DOM does not guarantee that it will affect the real DOM immediately. React will wait until the event loop ends, and then use this diff algorithm to calculate the smallest value by comparing the current new dom representation with the previous one. Steps to update the real DOM.
Recommended learning: "react video tutorial"
The above is the detailed content of What framework does react belong to?. For more information, please follow other related articles on the PHP Chinese website!