Questions about libraries vs frameworks

I’ve been told that if you use jquery in a web app that was built with react, you’re doing something wrong. I’m confused by that, because my understanding is that react’s functionality is primarily limited to UI design, while jQuery is more of a full fledged framework that closer mimics the full functionality of javascript.

Suppose you’re building a web app in react, but then you need to do some more complex js (i.e. some api requests, then perform so complex computations on the data). Wouldn’t it be ok to integrate jQuery to keep that code cleaner and more concise?

I thought the whole idea of using React is to get the speed. Be able to render the whole app with Javascript. Why add JQuery?

jQuery is a library for DOM manipulation: it is a wrapper over bits of the browser DOM API. That’s it, it doesn’t do anything else. This plays extremely badly with React, which has its own way of rendering the DOM. So there isn’t really any point, almost the only thing jQuery has that is useful in the context of React is the wrapper over XMLHTTPRequest ($.ajax), and getting the entire library when there are numerous small libraries that just do that (+ the browser’s native fetch which is perfectly fine most of the time) seems a tad exessive.

1 Like