Why people keep saying that Jquery is inferior to React?

From what I read so far, I have seen that all of 2018 discussions about Jquery states that it is dying because of new frameworks like Angular.js and especially React.

But I don’t understand exactly why, from what I read, React is for designing UI of pages while Jquery is a more simple Javascript to make it easy to manipulate DOM quickly than vanilla Javascript. They like do different purposes(from what I understand) but people still say that Jquery is dying to React and that ES6 helped at that.

Why? And do you really think that it is dying and that it is not worthy to learn it now?

Oh and I have another question, why Freecodecamp doesn’t learn you direct DOM manipulation by Javascript? Is it because the creators think that it is more effective and productive to use other libraries for that?

Just a note, I’m pretty much a beginner in Javascript so please correct me if I’m wrong.

It’s not inferior, jQuery serves a different purpose and is mostly obsolete due to improvements in browser APIs.

JQuery was built when there were significant differences between how different browsers implemented the JavaScript API used to manipulate the DOM. It made it really easy to work with the DOM, and it was a really good thing.

Most of what made it good has been taken on board by browser vendors: browsers now deal with things [mostly] in a consistent manner, and jQuery isn’t really necessary any more. DOM API methods like querySelector, querySelectorAll, fetch, addEventListener, classList, etc exist in all modern browsers. Up to say five years ago you would have normally reached for jQuery to do what they do, now you generally don’t need it.

jQuery doesn’t really help when building single-page JS-driven apps though, that is what React/Angular/Vue/etc are there for. They allow you to build applications that act very much like a desktop/mobile app. Doing that by hand via DOM manipulation can be extremely painful.

Basic, traditional websites are [because of HTML/etc] very simple applications, and don’t need a framework; jQuery was a good choice to add a sprinkling of JS but isn’t really needed any more in most cases. For anything more complex, frameworks add complexity up front (you need to learn how to use the framework) but reduce complexity overall.

That’s a good question. jQuery has a very clean, simple API that makes a lot of sense to users, it’s very easy to learn. There is a good argument to be made that it’s much easier to start out by learning that if you want to manipulate the DOM. I would say that’s wrong, that the browser APIs are the thing that should be taught as they’re more generally useful, and jQuery dying out means resources are going to thin out as time goes by, but :man_shrugging: