Hacker News new | past | comments | ask | show | jobs | submit login

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?



If 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


In which situations is React unsuitable? I learned web development starting with React and have been using it for everything since.


React 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.


I 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.


That’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.


React 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.


Something 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.


I don't agree at all. React is just as much a framework as a "way of thinking". I use react for _everything_ - because it's a great way to whip out a website - large or small. The "complexity" added is non-existent, unless it's because you are not willing to learn the way to do things. That's not the paradigm's fault, that's just people being complacent and lazy - sticking with "what they know" (which is fine, it's human nature).

Throwing together an API in .NET Core and a website consuming that API in React takes less than 5 minutes to get going.


Did you ever have to optimize for SEA/SEO/Page speed?


Any 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.


Hacker News, reddit, any blog, any newspaper.


You got to be kidding, HK? Newspaper? i rather choose SSR and got more SEO friendly than interactive components on screen for what? Newspaper?


Late 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.


It'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).


There'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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: