Difference: 1. Essentially, React is a UI library, while JQuery is a tool library or plug-in library. 2. Differences in Dom operations. React provides a complete set of virtual Dom. All operations are on the virtual Dom instead of the real Dom; while Jquery operates on the real Dom.
Related recommendations: "jQuery Video"
The difference between jquery and React
First of all, what we need to pay attention to is that although we put React and JQuery on the same table here, there are essential differences between the two. React is a UI library, but JQuery is a tool library or plug-in library. The reason why we talk about the two together is just because what we are talking about here is more about the difference in programming ideas between the two.
The most obvious difference is the difference in Dom operations. Reactjs provides a complete set of visualDom, which is a virtual Dom. All operations are in this virtual Dom. It is not the real Dom. React defaults to the real Dom not being changed. Only the virtual Dom is changed, and then the real Dom is rendered through this virtual Dom.
But Jquery is exactly the opposite of react in this regard. jQuery operates on the real Dom. The way it handles events is to use selectors to filter out the needs. Changed Dom elements, or directly monitor a Dom element. Finally, let's directly change our real Dom to achieve the desired results.
But what we need to note is that React itself does not make ajax. Friends who are not used to using simple fetch for background connections can also use jQuery’s ajax function. Yes, don’t always listen to some leaders who say that there is no need to use jquery or anything in react. Just don’t use it to manipulate the content of the Dom and ensure the stability and consistency of the overall architecture. That’s it.
The reason why Jquery becomes difficult to understand and quite bloated when the business logic is complex is because it combines the business logic with our superficial The UI interfaces are integrated together, and it is easy to change one to another. There is also a lot of interactive logic mixed in the UI, which makes the entire logic very confusing.
Finally, I have to say that JQuery’s position on the current Internet platform is still solid. Even if it has problems and complexities of one kind or another, as a beginner For people in the Internet industry, JQuery is a very simple and practical framework and tool. But as we gradually become familiar with this framework, we might as well try front-ends such as React and vue, and use native js to write some functions. , this will definitely be helpful to everyone’s learning and understanding.
For more programming-related knowledge, please visit: Programming Video Course! !
The above is the detailed content of What is the difference between jquery and React?. For more information, please follow other related articles on the PHP Chinese website!