7 ms·
I‘m new to frontent development. I had a lot of fun with jQuery so I‘m wondering: What‘s the problem with it? Do people now ise vanilla JS?
by atorodius 6y ago
I‘m new to frontent development. I had a lot of fun with jQuery so I‘m wondering: What‘s the problem with it? Do people now ise vanilla JS?
- scrollaway 6y agoIt's an unnecessary dependency for those using different frameworks. Its imperative model is also very incompatible with the reactive model that's becoming more common in frontend (React etc).
- irrational 6y agoIf you are using a framework/library like React, Vue, Angular, etc. then the need for jQuery goes away. However, the number of websites where a full-blown library like React is the right tech stack is probably less than 5%. For everyone else you would want to use vanilla JS, though if you are already familiar with jQuery I don't think there is anything wrong with using it. The funny thing is I spent years using jQuery and have also used Vue.js, but I'm just so tired have having to deal with importing libraries, setting up build systems, etc. that 9 times out of 10 I will just use vanilla HTML/CSS/JS and call it a day. It is just so much simpler. YMMV
- c1b 6y agoIn which situations is React unsuitable? I learned web development starting with React and have been using it for everything since.
- jfkebwjsbx 6y agoReact is meant to simplify application development, specially suited for single-page apps (SPAs). For a normal/small website, there is no need for a framework like that which adds unneeded complexity.
- baddox 6y agoReact is also well-suited for a single highly-interactive module on an otherwise non-React website. Of course, you still need to consider JS code size and loading performance, but it would often be completely reasonable to use React for, say, a very complex interactive form or table of data on your otherwise static Rails website.
- BigJono 6y agoSomething like Preact can be pretty good for this too. The one thing that makes React (by itself, not with all the stupid extras) good for this stuff (as opposed to Vue and Angular) is that it has a very simple API without much surface area, so it's relatively easy to maintain, just like jQuery. But where it still falls a bit short is the actual size of the library itself, it's a bit wasteful to package in React just for a widget or something.
- brmgb 6y agoI don't know. Being neither a web developer nor a frontend specialist (my professional development days are long behind me and were mostly spent on real time systems in Ada with some UI work using Qt), I recently developed a small site using react and redux. I chose the stack for fun but I found the experience a lot nicer than all my previous forays into web development. It felt a lot cleaner than what I was expecting. I think the stack pushes you in a clear direction regarding architecture and to me it seemed to make things simpler rather than more complicated.
- arcturus17 6y agoThat’s exactly why many of us use it, without giving much thought to the idea that it’s heavy or slow (which really makes me wonder what the hell some people are doing with their React apps...) The developer ergonomics, and the mental models which it prescribes - which are why I’d argue it’s actually a framework and not just a library, but that’s semantics - are really well thought out and can make you very productive. If I want to build a static site with minimal fuss I might still use something like HTML, Sass and vanilla JS with Parcel. For pretty much everything else React has become a default.
- mrastro 6y agoAny app that requires lots of direct DOM manipulation (which are pretty rare cases). Think making use of html `canvas`. Though there are nice libraries that abstract the ugliness like react-canvas, it would lead to less reusable code than the jQuery equivalent, imo.
- WillPostForFood 6y agoHacker News, reddit, any blog, any newspaper.
- xike 6y agoYou got to be kidding, HK? Newspaper? i rather choose SSR and got more SEO friendly than interactive components on screen for what? Newspaper?
- WillPostForFood 6y agoLate reply, but yes, I totally agree. I was giving example of things that shouldn't use React. Everything should be SSR, and no in page interactivity at all is needed.
- rtsil 6y agoThere's no problem with it, but its 2 main use cases are gone: ensuring a consistent idiom between various browsers, and providing a nicer API. Vanilla js does both now (if you really want to support older non-IE browsers, you can add a transpiling step). There's one use case that might remain: the jquery plugins ecosystem. You can find many replacements on npm, but they're a bit less beginner-friendly.