3

When using Angular or React, it's widely known that you shouldn't be using jQuery (or at least, should be using it careful only if you know what you're doing) because jQuery is a DOM toolkit and React/Angular have their own way of working with the DOM under the hood, and they will interfere and become buggy.

However, jQuery for me is more than just DOM manipulation. There's a huge ecosystem of libraries, Datatables, notifications/popups, carousel plugins, calendar pickers, so for me the real value of jQuery comes from being able to use all these prefabricated libraries rather than simply DOM manipulation.

In order to be able to use jQuery based libraries with Angular or React, usually a port/wrapper library is needed, that's why we have things like ng-bootstrap or Reactstrap to be able to use Bootstrap with Angular and React respectively, but usually these wrappers either are bugged, new software (=bugged), immature, or lack some functionalities (=don't wrap everything).

I'm trying to find a framework where you can naturally include jQuery (and also Bootstrap, since the JS file is based on jQuery) and its libraries without interfering with the natural flow of the framework. I'm pretty sure a framework like this would be less "magical" or less "automatic" (such as the automatic rendering and DOM updating of React) but I don't care if I have to render templates manually.

I heard Backbone can work pretty well with jQuery, but I haven't really tried Backbone so much, so I don't know. If you agree with this, can you also explain why Backbone works well with jQuery and has a better integration with it than Angular or React?

If you have a framework in mind, if you can please also try to include examples (explained verbally or with code, I don't mind) of success cases you've had using the framework plus a jQuery library.

  • 1
    What do you want to use the framework for? Maybe there are separate libraries for those functions? Because if you keep doing your own DOM manipulation, you will miss out on the greatest strengths of a framework. – gerstemout Sep 4 '18 at 18:41
  • 1
    Read my question. I said I didn't like using wrapper libraries because they usually aren't as great as the original unwrapped library. Also if the framework doesn't play well with DOM manipulation I miss out on the strengths jQuery and its libraries offer (as I already wrote on my question). – Felo Vilches Sep 4 '18 at 19:09
  • 1
    express is sort of a framework but not exactly in the same way as React or Angular. – William Oct 4 '18 at 19:45
1

I would pretty much use Vue for anything. An example from their own website:

In this example we are integrating a 3rd party jQuery plugin (select2) by wrapping it inside a custom component.

With any framework, you will have to wrap any jQuery activity in custom components, directives, or what have you.

  • Fine solution, the only problem is that I'd probably have to write bug-prone code myself, and would probably be worse than a wrapper library somebody else wrote. But still it's nice to consider for some cases. The use case I'm targeting is Datatables being used inside a framework, which is a very complex library. – Felo Vilches Sep 4 '18 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.