6 ms·
I disagree. As someone who recently made the switch from jQuery to React, it is way easier to shoot yourself in the foot with jQuery. React let's you focus on h
by dyeje 9y ago
I disagree. As someone who recently made the switch from jQuery to React, it is way easier to shoot yourself in the foot with jQuery. React let's you focus on how the component should behave instead of doing mental gymnastics trying to manipulate the DOM. There are always so many edge cases with DOM manipulation, it rarely turns out well for anything but trivial things (which I still use it for).
- shams93 9y agoYeah if you need a SPA jQuery won't work. Ultimately react and Vue will give you much cleaner code at the cost of learning the shadow Dom. All the old Dom methods from jquery and vanilla js over to shadow Dom instead.
- Klathmon 9y agoFYI it's "the virtual Dom", the shadow Dom is something different.
- masklinn 9y ago> Yeah if you need a SPA jQuery won't work. It will certainly work, there are plenty of SPA which use jquery (or even vanilla JS) for their DOM manipulation. But it will likely be significantly more painful and prone to desync bugs than using a vdom-based system Not just SPAs either, any non-trivial component is affected.
- philliphaydon 9y agoJquery solved a problem where building websites was a pain. Trying to listen to an event? Manipulate the dom? All painful. But the thing is we aren’t really building websites anymore. We are building web applications. And jquery just plain sucks for that.
- dragonshed 9y agoI challenge anyone to use jQuery to build a SPA and not re-invent backbone (poorly or otherwise). I built a simple site recently and one complex page ended up with shitty recreations of backbone Model and View.. and never knew until a colleague reviewed my code and suggested I look those up.
- temporallobe 9y agoI recently did exactly this and it wasn't that bad. It's not that I couldn't use Backbone, I decided not to because I didn't see the point in introducing yet another library when all I really needed to do was bind inputs to a model, which I did in about 5 lines of terse jQuery. Besides, I had custom widgets that wouldn't have benefited from Backbone anyway and would have required customization anyway. I think judicious use of libraries is ok, but tbe more elite among us tend to become libray snobs and shame people for not doing things the "right" way.
- Can_Not 9y ago> there are plenty of SPA which use jquery (or even vanilla JS) for their DOM manipulation. I've seen jQuery included in VueJS/react/ng2 for a specific complex plugin, and I've seen it for a few simple DOM manipulations where there was no reason for kQuery to do it instead of the framework, but is there actually a paradigm for jQuery being the root framework in an SPA? I've looked for jQuery SPA and found nothing. Does a jQuery SPA framework actually exist or are you talking about lots of homemade frameworks that use jQuery?
- faitswulff 9y ago> React let's you focus on how the component should behave instead of doing mental gymnastics trying to manipulate the DOM Agreed - a huge benefit of Vue is exactly that - it's declarative. You describe what you want with a (more or less) plain ol' Javascript object, instead of how you want something to work. It's almost like writing JSON - and is just as readable.
- rleija 9y agoReactJS is declarative as well.
- GhostVII 9y agoJSX is not declarative
- timbuckley 9y agoNot really sure how you can reach that conclusion. With JSX you are declaring what the HTML will look like, rather than specifying how to do the transitions. It's difficult to get more declarative than that.
- faitswulff 9y agoI wasn't saying that it isn't.
- dham 9y agoIt's easy to shoot yourself in the foot with any technology. People switch to a technology thinking they're writing better code with it, but in reality they're just a better at coding. Or it's a rewrite of something, in that case you know more about the problem you're solving. If you're bad at coding jQuery, when you switch to Vue or React, you then have gigantic mono components, if else if else rendering, 5000 state variables, or some other thing that you shoot yourself with.
- cstejerean 9y agoSome technologies make it much easier to shoot yourself in the foot than others. jQuery is in that category. Some technologies make it easy to do things right by making sure that the right way is the path if least resistance.