Hacker News new | past | comments | ask | show | jobs | submit login
React is the new jQuery (bradfrost.com)
225 points by brennankreiman 11 months ago | hide | past | web | favorite | 197 comments

> React is the new jQuery

Anyone who uses "the new jQuery" as some sort of insult (as it seems Sara did in her tweet) probably hasn't been a developer for more than a few years or is just trying to sound smarter than they are by bashing an easy target.

The reason jQuery got so popular is that it made common tasks so much easier than anything else at the time. Anyone who was doing web development before jQuery knows what a godsend it was at the time. JQuery was a fantastic leap forward for development at the time it was released.

JQuery didn't become bad, the rest of the development world caught up and made it unnecessary.

I don't think JQuery ever got bad. It just got unnecessary, like you said. But it took a lot of work to convince people that it was unnecessary.

A charitable explanation of Sara's tweet might be that, like with jQuery, it is becoming difficult to convince new developers that React may not be necessary for their next project.

The other comparative downside of JQuery was that components started to rely on it as a shared library, which meant developers suddenly needed to do dependency management. That is (usually) a bad idea. React absolutely does have that problem as well - probably to an even worse degree than jQuery widgets ever did.

This is kind of the same concern I have with Vue to be honest. I use Vue for prototyping and will probably use it in some final apps as well. But I'm probably not ever going to use a component that someone else has written if it relies on Vue.

IMO Lodash went the right direction with this. A component or library can depend on Lodash, pull in just the functions that they use for a final build, and then nobody else in the entire dev toolchain needs to know or care. No risk of conflicting dependencies, build size stays low, etc...

I kind of wonder if the problems Vue solves for me could be solved better by a smaller, lodash-style library instead of a framework.

> A charitable explanation of Sara's tweet might be that, like with jQuery, it is becoming difficult to convince new developers that React may not be necessary for their next project.

That's fair.

> The other comparative downside of JQuery was that components started to rely on it as a shared library, which meant developers suddenly needed to do dependency management. That is (usually) a bad idea. React absolutely does have that problem as well - probably to an even worse degree than jQuery widgets ever did.

I totally agree with that, but I don't think you can use that as a knock against jQuery, react, or vue. I think developers, especially js developers with our love of pulling in external packages, have yet to find a great solution for dependency management.

> IMO Lodash went the right direction with this. A component or library can depend on Lodash, pull in just the functions that they use for a final build, and then nobody else in the entire dev toolchain needs to know or care. No risk of conflicting dependencies, build size stays low, etc...

I think lodash can work that way because most of its functions are small and self-contained. It's easy to just bundle in a few select functions when they functions are 100 lines max and don't need the rest of the library, but I don't think React or Vue could use a similar approach.

Who is going to want to use a dropdown component that has the entire React 15.3 lib bundled into it?

> Who is going to want to use a dropdown component that has the entire React 15.3 lib bundled into it?

And who would want a dropdown component that has its own little rendering framework inside when you are using React for that?

Maybe not for a dropdown component, but I built a calendar component that stood alone using preact and redux, and the final size was still smaller than most calendar components of similar complexity.

Yeah, Preact is great for standalone widgets

To clarify what I was talking about with dependencies, many jQuery widgets used jQuery as a global dependency. This is very different from just building a bloated library - I might prefer a small library that has fewer dependencies for performance reasons, but I can still use a large one without any engineering downsides.

The problem is if I need to manage the dependencies between multiple components - if there's a singleton dependency that multiple components are accessing. It's dangerous not because it's a dependency, but because the components consuming it may have different requirements or assumptions that conflict with each other, and I won't be able to fix those assumptions without forking the components.

This is where you would run into scenarios where somebody's widget was only jQuery 2.x compatible, and somebody else's wanted to add custom events that interfered with scroll direction or something... I still have horror stories about trying to debug that kind of crap.

Shared dependencies really seem like they should be a good idea, but unless you're willing to fork other people's code or your app is only going to have a very short lifespan they're usually more trouble then they're worth.

To be fair, I think jQuery eventually did go the same way as Lodash. I haven't checked in a while but I'm pretty sure that they now have a way to generate a custom build of jQuery to be locally scoped to whatever thing you're building.

It would be tough for Vue to go the same route (still much easier than React) but that just means that you should probably only use Vue for your own projects and should avoid importing 3rd-party components that rely on having it globally accessible.

> Who is going to want to use a dropdown component that has the entire React 15.3 lib bundled into it?

...Nobody? Which is why peer dependencies exist.

NPM/Yarn aren't perfect by any stretch, but maybe mind Chesterton's Fence and refrain from reflexively assuming the developers of them are idiots?

Peer dependencies are a very valuable tool, and I'm glad that they exist, but most developers should avoid them in most scenarios. If a package requires a peer dependency, it's probably not worth using. There are exceptions but... in general.

This has been reinforced over and over again throughout JS history. jQuery, Grunt, Gulp, Angular, Bootstrap, and eventually React will join that list as well. You almost always end up with the nightmare of having to do package management because widget A and widget B interfere with each other. This is the same exact reason why it's good practice to avoid defining JS variables in the global scope.

Peer dependencies are just global variables at the package level.

To be clear, the people who built NPM were not idiots. Node handles packaging really intelligently - via a node_modules folder. There was a lot of thought put into how to make this system flexible: for example, you can have a node_modules not just at your root, but even in subfolders. This allows you to have custom implementations of a dependency that's isolated to a single folder in your source code, and to easily check your implementation directly into your VC.

None of that is accidental - the Node developers learned from languages like Ruby and Python, where gems and packages would be installed globally to the system, not locally to your project. They wanted a system that got rid of the majority of peer dependencies.

Jump outside of the web world and you'll see the same trend in the broader software ecosystem as well. The big hotness around Linux packaging right now is Flatpack, which is mostly copying Node's strategy of bundling dependencies into the app and then de-duplicating them after installation. Docker is an even more extreme example of this trend.

Peer dependencies are sometimes useful, and they're an important concept. But people use them and abuse them too much. They sound like they should be a good idea, so developers often don't realize the downsides until after they've gotten bitten - and even then they often just assume they were using a bad library or something.

9 out of 10 times you should avoid them, and you should avoid frameworks that introduce them.

So, two things:

I'm sorry that you've gotten bitten because it's frustrating when it happens, but "if a package requires a peer dependency,it's probably not worth using" is some cargo-cult stuff. Anything that acts as a extension system (coded to an interface) should use the project it's extending as a peerDependency. They are not "global variables", they're interfaces. It's what you're writing against! If you end up in dependency hell because of them, that means your dependencies are not speaking to the same interface, and that means you need to resolve the problem. Which can suck, I guess, having to actually do some work as a programmer, but somehow I think we'll all muddle through. Because the alternative is to silently have different APIs that will later break because the extended system has changed, and that is rather worse than actually knowing what's going on in your system.

React is a system that exists to be extended. Peer dependencies exist to facilitate this. Understanding one's tools makes cargo-cult sweeping-statement fears about milquetoast stuff really just unnecessary.

Flatpak is whatever (it's fancy /opt, that's fine) but, "jumping outside the web world", I'll put on my platform-architecture-is-my-actual-real-job hat right now and point out that Docker, while certainly appropriate for some use cases, is, for example, happy to cost you money in production when your big ol' app (shouts to my 4GB-heap-before-taking-a-request Ruby clients) can't copy-on-write. (After all, each process is supposed to be isolated, right? I mean, that's what people think...) There are real drawbacks to this approach, it's orthogonal to actually writing code, and the analogy doesn't really hold besides.

There is not a huge fundamental difference between a global variable and a global interface. That doesn't mean that interfaces are bad, but it means you should minimize the number of globally accessible interfaces that you have, and where possible opt for local interfaces that are accessible only to the classes that are extending them.

In any case, peer dependencies are a heck of a lot more than just an interface. They're a shared implementation. That's way more dangerous.

You're looking at this from the perspective of "well, my peer dependency is the interface I've blessed." What I'm saying is that for any long-lived project you are inevitably going to get parts of your implementation, interface, and toolchain wrong. It is therefore in your best interest to optimize for small, encapsulated interfaces that will be easy to remove or change later.

Unless you're working on a trivial project, you likely do not know enough about your project to bless an interface. You almost definitely don't know enough about your project to guess in advance which interface future 3rd-party dependencies will be using. You absolutely don't know enough about your project to guess whether or not your dependencies can rely on an evergreen codebase rather than a static one that you test once and then leave unchanged for the entire component lifecycle.

It's OK if you think I'm wrong about that. I probably would not have agreed with this two years ago. And you could very well be right and in two years my opinion might flip again. All of this is just opinion me, I've gone out of my way to say that none of what I'm talking about is a universal rule - you are going to need to share at least some environment code with your dependencies.

But it's usually true. You don't need to join a cargo cart to understand that some ideas tend to be better than others on average. It's not that I don't understand my tools, it's that I understand that tools evolve.

> But it took a lot of work to convince people that it [JQuery] was unnecessary.

First it took about a decade of browser and ECMA very intensive development to actually make it unnecessary.

> it is becoming difficult to convince new developers that React may not be necessary for their next project.

Give it a decade for the web "components" to actually become composable and for inventive and useful native language built-in solutions to state management to happen before you start advocating people out of React. Until then telling people they might not need React is not a step forward but backward. Imagine people saying "you might not need jQuery" in times where IE reigned and browsers were wildly incompatible.

Being used to jQuery, I really see no reason not to use it in new projects. I could learn all the new native equivalents, and even then still ending up doing more work than if I'd been using jQuery, just to save a little bit of page load time and filesize, but it would almost certainly not be worth it.

Indeed. I occasionally write a webbased tool to deal with a specific task (say formatting some form of codec data, or a simple dashboard for a specific event, or a small config generator, or whatever), userbase is in the <10 users (not concurrent) range, I don't give a stuff about scaling. I care that the code is in a repo (git, svn, whatever), is versioned (deb, rpm, whatever), and deploys cleanly.

I could learn and use $latest_thing, and maybe it would be great. That will triple the time taken to develop, but whatever. However in a couple of years time when I come to need to write something else, $latest_thing will be old hat, and replaced by $shiny_and_new. Rather than having 10 years of nice simple code based on jquery, I get some based on Angular, some on React, some on Vue, some on Meteor, or whatever.

I'm not a programmer, I'm not a wireman, and I'm not a carpenter. I program in the same way I'll run a network cable or get a screwdriver out, it's a tool I can use to solve a specific task. I like tools that are the same, year in, year out.

That's not to say the latest frameworks aren't all great, if you're building something for a million users and want to take advantage of shiny new features that's great, but for those that aren't, there's still a place for boring old things in a large part of the computer industry.

Take a look at zepto (or another jquery-like library), add some feature detection for IE polyfills, and switch to using fetch for ajax calls. Unless you're using a lot of jQuery dependencies, you'll cut your download size by more than half for most browsers/users.

I'd never say don't use jQuery, and it does support some options for a minimal footprint, still there's smaller options that probably have all you need.

It irks me that Javascript didn't just adopt the best parts of JQuery.

There are still things you can only do with jQuery, I can't think of a better Swiss Army knife for small tasks.

For example, fetch() is built into browsers now but it doesn't have all the features of $.ajax()

it irks me to use common functions such as selectors and Ajax in jQuery that are much, much slower than their native counterparts

Yes that's really a great way of seeing it. Jquery kind of graduated to obsolescence as many of its useful features made it into core JS.

When querySelector and ES6 came about, I found myself not needing jquery by default.

jQuery was never bad. As a tool it was fantastic at what it did.

But jQuery wasn’t just a tool, it was also community. What that community did/perpetuated was some pretty bad and ill advised practices. Plugins for everything - the old $.sum(2,2) joke applies here. DOM for state. Even sanctioned projects like jQuery UI were guilty of some terrible, awful practices.

That said, React isn’t the new jQuery, it’s the new Backbone. Backbone lacked so much - and did so little - that it’s deficiencies needed to be made up for by “other” tooling. As a result, there was O(n) ways to “Backbone” – making backbone apps very difficult to study/build/maintain.

React is fine. The community just needs to coalesce.

Edit: typing on my phone; and am lazy

I think a lot of that does happen with React. Before Redux there were so many Flux-like libraries. material-ui and react-bootstrap are very widely used for UI/UX baseline. There are a ton of options for everything, for me it comes down to the following.

react, redux, thunks (with async functions), fetch, material-ui ... those will get you a LONG way to where you need to be with react.

I agree jQuery was very useful early on, especially since it abstracted cross-browser differences and APIs.

However in my experience, a couple of things were key to creating a negative view of jQuery:

1. Security and unsafe defaults, for example: evaluating remote JavaScript by default [1]; and unsafe DOM parsing by default [2]

2. Not really to blame on jQuery, but its ease of use for DOM manipulation led to programming patterns that aren't easily scalable, for both code and performance

[1] https://nvd.nist.gov/vuln/detail/CVE-2015-9251 [2] http://api.jquery.com/jQuery.parseHTML/

To be fair, when jQuery was growing up PHP with magic auto global variables was the fury.

Times were different

I think by 2006 magic auto globals was already off by default (4.2, which was released in 2002, was the one that turned it off, and though 4.2 was still widely used by the time jQuery came about, register_globals was considered bad practice in general by at least 2004, if not even earlier).

good point. Your timeline is accurate, and while PHP installs tend to be out of date and people following tutorials would just turn off security features, by 2006 the trend should have been in decline, yes.

More than anything, the crazy thing for me is that jQuery seemed to have been there from the wake of the web, when it came out only one year before the iPhone.

Well kids these days. They said webkit is the new IE, and said the IE era was IE7. Sigh

I cant even name a similar piece of software in web development history that is as important as jQuery.

Despite Web development as a whole, back end or front end is still no where near being good enough, it is still many times better then the old days.

>cant even name a similar piece of software in web development history that is as important as jQuery.


Nah, there were always tons of alternatives to PHP. What real alternatives were there to jQuery? There were none.

I know this is a rhetorical question, but Prototype.js was pretty similar to jQuery; although jQuery won the popularity contest.

I don't presume to be an expert on history (only entered the webdev domain in 2010), but didn't prototype come out at least a couple of years after jQuery?

Prototype was released like a year before jQuery.

Absolutely my bad there. Thanks for the info! jQuery's popularity must have been phenomenal, because I hadn't heard of Prototype until maybe 2011.

I think Rails used to include it as a default.

Mootools had a fighting chance.

Javascript is irreplaceable to the web

Netscape navigator?

Php is important in the way it exemplifies the total failure of the software industry to take advantage of it's 40-50 years of accumulated knowledge...

> I cant even name a similar piece of software in web development history that is as important as jQuery.


There were other web servers, there weren't other jQuerys.

I get the point you're mentioning but jQuery was there with Prototype.js and Mootools.

And Dojo and YUI and a couple of others.

But Apache was born before jQuery, and continues to live on after jQuery (should have) died.

Agreed. Furthermore, a lot of those tasks were downright unnecessarily painful and tedious time sinks, e.g. browser agnostic control when the ecosystem was much more fragmented and HTML5 more nascent. Also, jQuery's documentation was solid, and it was very easily extensible.

Back when browsers were wildly incompatible jquery was a life saver. Sure you could do painful dom code and then have all kinds of libraries that have to be loaded in the right order to support all browsers or you could just include jquery. Now in the era of the progressive web app SPA jquery is outdated. Even for low level dom its still outdated because modern browsers follow standards really tightly especially compared to the bad old days. Frameworks are starting to get outdated in the face of tools like Svelte as well as Polymer 3. You can pull off a SPA with Polymer 3 on modern browsers with no shims at this point, except maybe shadow dom, but Polymer 3 has selective shimming so you don't have to download one huge shim file.

jQuery also predates standards such as querySelectorAll and fetch, so no, it wasn't just compensating for browser incompatibilities; it also provided a far more pleasant API.

React is in a similar boat - it provides a far more pleasant experience keeping the DOM in sync with your application state, in a way that Web Components don't (although they have other advantages that make them great when used together with React).

Insulting is really what i felt too. Simplicity, size, ubiquity, plug and play are the opposite of react.

I would understand if comparing VueJS with jquey. Even if they are very different, the philosophy is the same: a small elegant easy to use versatil tool.

Agreed. I LOVED jQuery and I could do some serious damage with it before Angular/React came along.

Hey, those young kids just don't know how frontend development was before jQuery.

> probably hasn't been a developer for more than a few years or is just trying to sound smarter than they are by bashing an easy target.

Yet, Sara is neither of those, she's a well respected developer, who's work with CSS and SVG is world-class.

If she's using jQuery as a comparison she's doing it from a place of experience and knowledge

Who is? CSS and SVG are great, but how is her javascript? Neglecting the role that jQuery played is foolish, and even respected developers can say foolish things now and then.

Unfortunately the shortness of the tweet leaves much to interpretation. Perhaps the analogy she was getting at is simply that it's being used in solutions that do not benefit from it.

I know what a pain Prototype.js and others got to be... jQuery was a lot cleaner, though in retrospect, I wish they'd passed the context in as a property, instead of relying on "this", also wish they'd passed it as an already jQuery wrapped representation.

Is jQuery unnecessary because the functionality is built into js now? Or browsers? Or other libraries? If it's libraries, are those libraries providing a superset of jQuery or are they just better?

Yes, the DOM API's have greatly improved and are well-supported among browsers now, so jQuery is no longer needed for that. React doesn't solve the problem of inconsistent and unwieldy browser API's (which isn't a problem any more), but of a clean architecture for web applications.

jQuery is not that necessary anymore because difference between browsers' js implementations are not that big. You still have small differences in events but nothing like it used to be

As someone who learned web dev in the era after jQuery was marked by many as deprecated, I started to resent it mainly because of all the StackOverflow posters that give jQuery answers to JavaScript questions. (Plus the cases where CSS would suffice.)

Unless you were doing custom jQuery builds per project (which no-one was), it was always bad. People would routinely drop in the 35kb lib and only use 3-4 functions.

That's not really a problem with jQuery, that's a problem with the way people were using it.

Also, a slow loading JS lib wasn't as much of an issue 5-7 years ago when jQuery was really in its heyday. Web pages were simpler and more information based back then and it was usually a requirement that they be useable without javascript. Since you are (should be) loading jQuery at the end of the page (or asynchronously) the page should render just fine without jQuery and probably would have been loaded by the time any user interaction would have happened.

Also, since users were on computers (mobile wasn't really a thing) and data usage wasn't a limiting factor (most plans were unlimited), loading extra data didn't really matter that much.

Yeah, jQuery had extra functions that you didn't need, but it didn't really hurt much at the time and there wasn't really a better option.

It still doesn't hurt. Less than 300k of a cachable library isn't a big deal for mobile data, and jQuery has never (in any example I know pf at least) been the reason a mobile page is slow. Sites like the default mobile reddit manage to be absolutely atrocious without it (10+ seconds to load anything even on wifi), yet lots of sites with it are completely fine on any smartphone in current use (such as the same phone mobile reddit takes 10 seconds to load on because it's using some awful ajax setup - seriously, they had perfection with .compact and just abandoned it for this crime against humanity).

> Also, a slow loading JS lib wasn't as much of an issue 5-7 years ago when jQuery was really in its heyday.

Not to mention it was recommended to point your "src=" to one of the common cdns, so it would likely already be in the user's cache from some other website that used the same jquery version.

I wish typical webpages would only pull 35kb of resources.

I wouldn't say jquery was bad. It was really a nice API with interesting innards. Easy to abuse, of course, it was too popular not to end up being the first thing people try to have 'modern' websites.

Oh Brad, you do not know what you are talking about right off the bat. Let's go through your list.

1. Every document has a root node. <div id='app' /> is your root node now. You had a root node before, you have a root node now.

2. Do a search and replace. That's easy.

3. That's another search and replace.

4. You don't need to call a constructor, you don't need to use bind, and you don't need to assign your functions to an variable on your class instance.

React allows you to compose things. Make something once and use it everywhere. You write much, much less code. You get lifecycle hooks for when things mount, update, unmount. You get easy templating in JSX. You can also ditch the whole thing for Inferno if you care about having no lisence or company behind it.

You also get amazing libraries for state management and async via reactivex.

I like Brad's articles, but recently it has seemed like he has struggled to migrate on React, and some recent articles have just been trying to criticise React but with bad (or false) arguments, which makes it appear just him trying to justify himself not being able to wrap his head around.

React is great, mostly for bigger web apps that do need a framework and more structure, such as an SPA with multiple team members working on it.

Just like jQuery is great to do some quick and simple dom manipulation.

I've tried both opposites; I've been on teams working on large apps in jQuery, and it's hell. And I've also used React to implement simple little things, and it's also hell (part of it for reasons Brad mentions in this article).

I don't have much experience with Vuejs but I've been using it instead of React recently, and it's refreshing indeed. Just like jQuery you can just import it with a script tag and start doing some dom manipulation and it makes the code much cleaner than jQuery.

And as others have said, jQuery is not bad - it's awesome. I guess it didn't age very well with the JS env evolving, but it's great.

>React is great, mostly for bigger web apps that do need a framework and more structure, such as an SPA with multiple team members working on it.

I'd argue this is bad advice. What constitutes a 'bigger' project us arbitrary, and once you build your whole app on jQuery it's expensive to migrate to React once you get just a bit 'bigger'.

Now whether or not all websites need to be React-based SPAs is a different question entirely.

yeah you are right about the cost of migrating, I've been through one and it's indeed to be avoided.

I badly used "bigger". What I meant was more in the lines of React is great to build what we could call web apps - something with complex logic, etc. While jQuery is better for simple DOM manipulation.

Maybe a good line is, as soon as you find yourself manipulating data you might want to think about using a framework such as React.

You also get convention. jQuery didn't offer much of that once you started gluing its functions together...

I can usually jump into someone's react code and get what's going on pretty quickly unless they did something really gnarly with incredibly nested props. Even then, at least I still know where to drill down. With jQuery soup, you didn't get that luxury.

Being able to have an entire team know how to build components and provide them with functionality is an incredible advantage. I don't love everything about react either, but the ecosystem, somewhat enforced convention, tooling, etc - it's worth it (so far).

I love some things about Vue, but it isn't a silver bullet either. Brad seems to be pretty butt hurt about react. If you've worked on a large team without something like react, then worked on one with react, it really shines. It's a major productivity booster.

It's not perfect, but it's very good.

jQuery had a lot of convention, for both it and it's plugins.

jQuery + co. have very consistent "look and feel"

I agree when you’re talking about the most well known of plugins and so on, but IME for application code all that goes out the window. A lot of developers really didn’t know how to write JavaScript back then. Still don’t, but we didn’t then either ;)

I agree that the library has great convention. I actually learned quite a bit from that API when I was starting out. The only problem was you could really abuse the usage of the API.

I'm realizing now that this isn't a fair comparison. React 'wins' here largely because it has a smaller scope. It's for giving functionality to templates built in the library using a certain approach. jQuery was far more open ended and far less opinionated. That was as much it's strength as it's weakness.

It's definitely not a direct comparison. But I do think react is a nice safe tool for larger teams.

Ok, so Brad is already making sweeping declarations about React, yet less than a month ago he specifically posted about his struggle to learn it: http://bradfrost.com/blog/post/my-struggle-to-learn-react/ cool...

Almost like some people don't quite get that's its intended to be used for complex applications rather than just websites.

> hey there! I'm Brad Frost, a web designer

Well, of course he will struggle to learn React. Web design and software engineering are two different fields… Not saying he needs a master in CS to learn React, but he will surely need to learn a bit of programming and JavaScript before jumping on it.

> Burn all of your markup down to the ground and replace what you had with <div id="app" />

This isn't totally true -- if you really only wanted to implement a single toggle and leave the rest of the page alone, then you could replace just the relevant DOM elements with a container and render into that fragment of the page. (Though really I'd ask why use React if that's the only value you're getting out of it)

> I guess that’s why I’m still struggling to comprehend why so many organizations are so eager to take the sturdy, foundational layer of the frontend stack and rewrite it all in a proprietary format. [...] Projects like Vue are showing that’s not necessary.

Except, Vue.js does require a proprietary format; all those v-* attributes and custom components will be need to be migrated if you want to switch away from Vue. Comparatively, React is better in this regard because there are multiple implementations of React (preact, inferno, nerv). Also, JSX is technically optional, and it's really easy to mix markdown, or other formats/templating engines into a React app to handle the content-heavy bits.

I feel like the word "proprietary" means something different to me than the author. When I think of proprietary I think of a closed standard that may or may not be copyrighted/patented. Something like React would not even come close to my definition.

Wikipedia seems to agree with me [1], but maybe I'm misinterpreting it:

[1] https://en.wikipedia.org/wiki/Proprietary_software

I think there is some confusion comparing jquery with frameworks in general heh- time for a history lesson! So back in the mid-aughts right before jquery there was prototype. I got hired into a job where I had to maintain sites written with both in the past and they were very similar to each other. Ajax was new and so was the class based handling of JS to make it more object oriented. It could be done but prototype made it convenient. It was possible to manipulate objects before applying them to the DOM however it was really verbose...academic I would call it. Then prototype’s cool younger brother arrives (jquery) and it became so easy to pull this stuff off it was like a giant party. Learn jquery? Your hired! Ahh the halcyon days ;) Anyhow- if you’ve lived through things like CGI and DHTML (and java servlets to a lesser extent) they were like the malaise era of web dev but jquery flipped the tables there has been NOTHING like it to date. We’ve gone back to academic with colorful packaging (I’m lookin at you angular!) and react coupled with redux just isn’t the same- it’s interesting but not a quick study. So..back then we could pick up a program in 24 hrs book and land a job. Today we can read 24 books and scratch the surface. Jquery was a movement not a framework and the statement being made was life is too short to NOT be incredible, we can all be incredible with jquery so why not? More comparable to the Misfits showing up to a Johnny Cash show than just another framework...just my two cents.

There were also mootools and dojo.

I was more into those two but jQuery made everything dead simple.

Mootools was great! They took what was good about mootools and built that into React.

A lot of the mootools team moved into React. At least the ones I was familiar with.

and dont forget scriptaculous :)

I'm having flashbacks to 2006! mootools, dojo, prototype, scriptaculous, jquery.

Sometimes all on the same page!

To be fair, the things we create today are often far more complex or at least are done in far less time than back then.

A common flaw in software engineers is writing thinkpieces about technology they don't fully understand yet. Giving it a clickbait, not fully baked title is a bonus.

Move along. Engineers will continue to use good technology they understand (like React) while newcomers will continue to try to emotionally justify technologies they don't want to learn and use.

I agree with the spirit of what he's saying, although I don't think jQuery is a very good comparison to use.

React is a decision. I'm speaking in broad generalizations because I don't know how to put this principle into more specific terms, but good programmers should avoid making decisions for as long as possible. This is the same reason why I caution people against using test frameworks. Most of the time when you start coding an application you won't have enough information to make any educated decisions about it.

This is a huge advantage that Vue has over React. You can use Vue for just one component out of your entire app and it's fine. It is fairly easy to separate it from all of the rest of your application logic and that means by extension it's fairly easy to rip it out later. Or at least... easy enough.

It's still not perfect. I dislike how hard it is to make its templates fail gracefully when Javascript is disabled. I dislike that it uses setters in its data model, which discourages immutable programming. I dislike a few other things as well.

At some point, someone will make a better framework than Vue, probably by building something even smaller and even more focused than Vue already is. But in the meantime, if you are going to use a framework for two-way data bindings, you should probably be using Vue instead of React. Opinion me, of course.

Let’s not forget that jQuery was a polyfill that allowed JavaScript Devs on all browsers to code to a common baseline. React is a nice —- and popular —- library for building UIs but it’s existence isn’t an indictment of the laziness of standards implementors for browsers (okay, IE mainly) and god-send to developers like jQuery was.

Yes, React isn’t _exactly_ jQuery, but it gives the same level of productivity boost comparing to development with just the modern DOM APIs (querySelector, classList, etc).

For a large project, React gives you way, way, way more benefits than jQuery does.

If you tear out something like jQuery, you’re going to have to figure out a way to get those accordions to expand and collapse again. If you tear out React, you get a blank page. React is a big commitment.

This is probably the only real concern I see.

jQuery is a library for DOM manipulation. It can co-exist with many other libraries.

React is an entire framework.

These days you need jquery less because browsers are more standards compliant and css animations basically work.

The trick is about using the right tool for the right job.

We have several large react applications - these are user-interaction heavy rich single page apps.

But we also use vanilla html and jquery dom manipulations in many other places.

> These days you need jquery less because browsers are more standards compliant and css animations basically work.

Originally, jQuery's big selling point wasn't that it handled animations, it was that it gave you a query selector, and one that could be used in any browser. jQuery predates the release of chrome, and came out a few years before document.querySelector was added to Firefox and Chrome was released.

jQuery was monumentally more useful for common actions compared to its contemporaries, such as Dojo, MooTools and Prototype.

What does "an entire framework" mean? Because you can just make React the little news and weather widget in the corner of your app / website, as the only React component. Same with Vue.

The people for whom ripping out React or Vue leads to a blank page are those who wanted an app from the ground-up.

If anything, React is losing because it doesn't include enough out of the box. If you wanted to build a news widget, fine. But if you wanted to build an app, you have to start putting pieces together from 3rd parties (or write your own custom pieces). That's not what a framework sounds like to me, that sounds like figure-out-your-own-framework, and I think that's why Vue is winning.

Create React App was a very late response, and I still don't think it's as good as Vue's up-and-going tooling experience.

I guess what I meant was when you build a widget with react - the whole widget has to be react.

With jQuery, you're likely building it with html and using jQuery for user interactions or animations (I know - not always true - constructing the markup with $('<tag>') is also useful). So its easier to rip out jQuery and replace it with - say - document.querySelector - or whatnot.

I personally think React is overkill if you're pulling it in to do a small widget on a larger non-react page

> What does "an entire framework" mean? Because you can just make React the little news and weather widget in the corner of your app / website, as the only React component. Same with Vue.

Is there a step-by-step tutorial for this? I was googling for one yesterday, because I have a legacy app and want to start moving small components (like datagrids) out of server-side rendering and into components.

The best I found was https://reactjs.org/docs/add-react-to-an-existing-app.html, which reads like it would make sense to an xperienced React developer, but not someone coming new to it.

I've been spending hours and hours the last few days working with react/vuejs/react native/native script+vue. It's hard picking a stack for staticish sites/pwa/pwa+e/spa/mobile! Throw in moving from .NET/IIS to .NET Core and tinkering with Node.JS/Express and your head is going to be spinning like mine (let alone worrying about authentication, API first, SSR)

Right now I'm moving an old webforms project to .NET Core + MVC / Razor and am going to try building out some components in both react and vue to see how it goes.

As for some links:

Here is slightly old .NET/MVC5 article: https://www.red-gate.com/simple-talk/dotnet/asp-net/a-real-w...

Vuejs for .NET/MVC5: https://medium.com/corebuild-software/vue-js-and-net-mvc-b5c... https://medium.com/@hyounoosung/integrating-vue-js-2-0-to-ne... https://medium.com/@disjfa/using-vue-js-in-existing-websites...

Do you find it difficult because it suggests you need to deal with JS modules and building? After you get your tooling setup, you can just include a node in your DOM that React will target and mutate.

I find it difficult because of understanding how to get it to fit with an existing directory layout. And maybe existing scripts in the build. But yes, setting up the tooling is overwhelming.

create-react-app says in the README: "If you need to integrate React code with a server-side template framework like Rails or Django, or if you’re not building a single-page app, consider using nwb, or Neutrino which are more flexible."

So I go and look at nwb and Neutrino, and there's nothing there going "Need to use us in a legacy project with its own directory structure? Here's how".

I feel I'm missing a piece of the jigsaw...

I might prescribe that you go to reactiflux (not associated) or other popular chat communities to get some more live help for getting your tooling up. I suspect that if tooling were resolved, so much discussion of churn would disappear overnight.

That's because you aren't using Reason-React

Could you explain more about Reason? I've been curious about it for awhile.

It's typechecked with redux and router built in already but still early so not all bindings are there yet for libs easily found for react/typescript. Maybe not for all projects that need that strict of type checking.

>>If you tear out something like jQuery, you’re going to have to figure out a way to get those accordions to expand and collapse again. If you tear out React, you get a blank page. React is a big commitment. >This is probably the only real concern I see.

I'm sorry but this is not a problem. If you commit to React then you commit to it. You are not suppoused to change it every other year.

Imagine a big C++ Qt application. Will you ever think of changing Qt on it, and expect no huge cost? No. That's unreasonable.

So what he wants is not only a cross-browser, cross-platform framework (and much more) but also a framework that is somehow "cross-framework"!!

This is really getting me. People, such flexibility and ubiquity is NOT FREE. People this days complain about the web being to complicated, and that it is a lot of complexity to make something "simple as a webapp". I agree, it is. But that simple multimedia webapp you get today works over a distributed network, in almost every platform, from mobile to desktop to almost everywhere. This kind of ubiquity will be unthinkable in the early 90s/2000s without investing on a huge number of experienced dev teams and a huge especialized codebase(s). Today some javascript framework and markup will give you almost the same product. Yes, I think the web ecosystem can be improved. A lot. And the end result is not always 1:1 comparable at many levels with what you would get back in the day with native apps and a load of work and experience. But still.

People complain but they don't know what they are getting.

Moved from Vue to React. A couple things drove this: Typescript support for Vue was kind of weak, and the interception of events and reactive elements ended up creating more bugs. I do love how Vue is easy to get up and going fast, but React seems more compatible with a growing team where you want stronger guarantees.

First time I read someone moving from Vue to React. I thought trend was only from React/Angular to Vue?

Vue works better for small apps, or progressive enhancement (similar to jQuery)

React works better for teams working on applications that need build tooling and dependency management anyway.

Angular, frankly I don't see why anyone would pick it over the other two. Yeah, it's got more in the box, but that bigger box takes 4x as much effort to lift off the ground.

i hope their switch to managing reactivity via Proxy solves stuff like this.

I think people got carried away with the JSX side of React (which IMO is really just the icing on the cake) and forgot that React was probably the first view library that introduces the notion of the DOM as a pure function of data. It made functional programming mainstream in front-end development. This purity makes UI extremely easy to reason about and makes all DOM changes tractable. I was in a Backbone shop before using React and I remember Backbone was such a chore to manage in a large application. We switched to React and never looked back.

> It made functional programming mainstream in front-end development.

I totally agree, and in fact I would take it a little farther and say it's making functional programming mainstream on the backend as well. Many people I've worked with got their taste via React/Redux and then started adopting things like Elixir/Phoenix for the backend.

Maybe it's an overstatement, but I credit React with driving at least some of that.

Its funny because JSX is totally unrelated to React besides just being a heavy convention. You can use a totally different template system if you plumb it up correctly. Plus JSX can be used outside of React.

You hit on the two points that makes React what it is. A pure state -> ui abstraction and the ability for large projects or teams to use it efficiently.

The problem was never jQuery. jQuery performed a very necessary function when it was created. It was always the intention of the lib to cease to be needed over time. The problem was/is the ecosystem created around jQuery. Want to do a thing? Do it with jQuery. Want to read a cookie? Use jQuery. Want an image carousel? Build it with jQuery. Want to do anything at all? jQuery.

I do see something similar happening with our more junior devs. Their Google searches have now turned to "how do I read a cookie with React?"... and sure enough, there is a react-cookie lib - which may or may not be useful for their task... but since it says "react", it'll probably show up in a pull request. React can't be blamed for this though. All the ecosystem being built with the expectation of "well everyone's using React", _is_ a problem.

Education about separation of concerns is the only solution I can see.

Brad Frost makes most of his money telling people what they should do instead of actually _doing_ himself.

He's given hundreds of talks all over the world about a component-based approach to style guides in web, but yet cannot fathom the need for React.

I find myself defending myself a lot these days here. I use vanilla js. Never had any trouble, I literally have no bundle, no dependencies, the amount of code I have to write is basically the same either way, no trouble syncing state with DOM either. Have done so in two moderate projects (40k, 15k). Everyone I meet looks at me like I'm crazy. But in the same breadth say the site feels so smooth and responsive. No shit.

Catch being you he to learn how to write js but that's true for any framework as well. And frameworks have smaller shelf life anyways.

I agree you can do that but I feel like frameworks are more about teamwork. I can't imagine having a team of 10 with varying levels of JS experience/passion and telling them all to "just write nice simple vanilla JS that we can all agree is clean and simple" and expect that to happen.

I don't have a ton of experience leading team's using react, angular etc but I assume you are referring to the fact that there are multiple ways of doing things in vanilla js world whereas only one way in react world. That can make things easier for teams but I believe that's a lazy excuse. Choice is never a bad thing and it's literally the job of a tech lead to establish conventions, tell devs what flow to follow. If that turns out to be too difficult then it's not the code or framework's fault. Staying strict about how to do things is a concept that exists irrespective of framework or no framework.

Have strict team conventions and being afforded the time to try an enforce them is great. Agreed. It doesn't always end up working like that in my experience though. Frameworks often have a community that provides some convention guidance. Rails, for example, is huge on this. You can tell a developer "stick to the general Rails way of doing this" and they will often be able to follow that instruction. Is that lazy? Sure, probably. But I also consider it to be a feature of a framework.

Do you have any advice for developing this way? I've found myself too sticking in the VanillaJS camp, but not being able to talk about React seems to dissuade potential employers.

My only advice would be to stay consistent, find patterns and genralize stuff. I do see the irony of making a framework of my own in the process of doing all that. I just embrace that. Everything is exactly how we want it and we know each line that executes on the machine. Makes development a breeze. There is nothing that react can do that vanilla js can't with reasonably same amount of effort. But stay open-minded. What helped me was that I worked with angular first to see how not to do front end (angular.js). I also regularly check out how react, angular, Vue, etc handle the same problems that I have. That usually gives an inspiration.

In the end it's hard to believe how fast JavaScript can be even on smaller devices.

I agree with you and I do most of my stuff in vanilla JS these days, but if I have a complex UI state it can be nice to have a DOM diffing library rather than tracking and editing nodes explicitly.

Mithril is, in my opinion, React done right. The entire framework is contained in four methods. It doesn't have any awkward leaky abstractions like Angular, and it is super light and responsive.

React is a great abstraction, but some projects abuse the virtual DOM concept and you end up with a lot of unnecessary reconciliation (VDOM diffing) going on that slows components down.

Not a snarky comment, but have you had to share this code with other developers? If so, how did you find getting them up to speed without shared conventions?

I have a team of 4 devs working for me. It took them a week to get up to speed with and work with full efficiency. Everyone knows JavaScript. It's nothing new, we're just using it without any added syntax. Everything is familiar.

Curious are you writing newer style javascript with polyfills or just plain old school javascript?

Es2018 all the way. Web workers, classes, Isomorphic code, generators, async await, etc with a splash of Babel Devs have never been happier. Everything just works and online documentation is Rich and plentiful.

Plus as I said, core logic works on both server and client and we have offline support as an added bonus.

No bundle but you use Babel? How does that work?

Babelified code sits in another directory, I hotswap it if I think they are not on a modern browser (IE or older version of mordern browsers). So any normal Joe using chrome or ff or edge will not get a bundle. But if I'm not sure, the backwards compatible version is sent instead. So I think I can claim that there's no bundle since most of my users don't get one.

React has a lot of inertia behind it, although it doesn’t really make things easier.

The amount of js code to make even basic things work is high, and with so many different styles of writing react/js code, large codebases require significant effort to keep maintainable.

Which is to say, with this much effort put into structuring maintainable react js code, one could pretty much develop in any js ui framework (including jquery, backbone or none whatsoever) - since little of this effort is dependent on react, or made easier by it.

Virtual DOM and ability to derived your DOM state from props and state is not something you can easily done with jQuery or any UI library that doesn't have that concept.

It's not something you can easily implement yourself either.

That's the main part that makes React code maintainable.

I agree, this is the part that people seem to be ignoring. Yes, you can make a proof of computational equivalence between jQuery and React, but you cannot deny the massive increase in human usability that an set of components brings. There's far more interesting set of things you can do, Redux + the litany of other related libraries, a vibrant ecosystem unto themselves, prove this. I started my career out slinging jQuery and after 4 years of React I never want to go back.

Maybe development requires more overhead, but you have to factor in reading understanding and maintenance. React, with a proper state management library like React, in my humble limited opinion, is easy to understand because of its functional nature. The view rendering is a function of the props it receives, whether it come from a context based store like Redux or just passed thru. I don’t find reading other peoples React code terribly difficult because most of it is not surprising. Even components which make heavy use or internal state are never so terribly difficult to understand.

I don’t think the same could be said of your random JQuery or. Backbon based project

I disagree. Bridging the concerns split between between HTML, JS and CSS helps a ton and would be a lot of code to write if not for React (or similar frameworks).

I feel this is because many people confuse Redux (or flux) with React itself.

Or the more general problem of not knowing the difference between store state, local component state, and component instance state (the actual JS object's properties.)

The new Unstated library leveraging the next Context API is a nice balance I find for state management. It basically just mirrors Reacts setState style update system. Although you do lose the single source of truth pro of Redux.

I really like the linked Vue/Jquery article in the story as well. I've built some stuff in Vue and I really like it. It can be incredibly simple.

I'm not a huge fan of React. I'm really not a fan of any site that requires Javascript to view. If it's a new article and I get a blank page, I immediately stick it in archive.is. I'm not turning on Javascript for your site just to view content. Fuck that. Fix your site to not suck shit.

I realize you can easily get into the same thing with Vue .. and I think Vue, React and others, makes sense if you're actually running a web application. Your main page, login page and other content pages should be static, no Javascript required. If you have a new site or a blog or graphics, why the hell are you requiring React/Vue/Angular or some other framework? Just display the content.

I haven't really looked into server-side rendering, but I suspect that still requires Javascript to be enabled on the client? Are there any newer Vue/React style front-end frameworks that are designed to still degrade gracefully without Javascript? (I suppose you can't really do this without pairing it with the backend language on the server).

I really like how Hackernews still supports a Javascript-less system, even for things like up/down votes (although I still turn JS on for HN to avoid page refreshes).

React can definitely use Server-side rendering... but it's often used for pre-render caching, and even doughnut caching to bootstrap the full application on the client, so you see content sooner. But, it's entirely possible to pre-render and degrade gracefully.

Is it worth the effort for a fraction of a percent of technical users whining about the need for JS? probably not.

When javascript Is disabled you just loose the pwa features, pages are full loaded as html.

For SSR you are sending the HTML text instead of JSON. Time ago you needed nodejs for SSR I do not know the alternatives today.

When I see this:

    var formname = $(this).find('.formname');
I think why not just use plain Javascript and do this:

Coders that are attached to libraries and frameworks always seem so afraid to use the tech already available. That they don't even look at how the basic solution would look like.

Apples to apples -

The jQuery solution is shorter, and it works in browsers without querySelector (old IE) and without innerHTML (which is missing/readonly for some element types in old IE).

Sorry for being terribly pedantic, but the "vanilla" version just does not do what the jQuery code does:

- `this` might not be document

- find might return multiple elements, not just one

- if nothing matches, jQuery does not throw unlike the vanilla version

I do understand it's just an example, but if you'd consider all the implicit cases the jQuery example covers, you'd end up with a lot more than a single line. I see your point, but using off examples like this don't really sell it too well.

assuming "this" is an element... `this.querySelector` if you're intending to match multiples...

    Array.from(document.querySelectorAll(...)).forEach(x => {...})
It's not *that hard... though forEach should be on your dom collection returned, if Array.from exists, but I started shimming Array.from long before either were standard.

These seem to be unintended side effects. From the example it seems the vanilla versions behaviour is what the author wants.

Today yes. Good luck with that back in the Internet Explorer 6 days. Cross browser compatibility is what motivated jquery in the first place, today it has played out its role as a cross browser DOM manipulation library.

Modern libraries such as React and Vue however play a totally different role. They introduce proper architecture to web development such as separating the view from your business logic with data binding, they can not be compared with jquery which was just a nicer way of doing the same old manual DOM manipulation.

Real life example: https://caniuse.com/#feat=urlsearchparams if you need to support IE11 then you can't use the URLSearchParams object. Your best bet is still a jQuery library.

I'm currently refactoring a jQuery frontend to native Web. The verbose naming is really unfortunate, jQuery wins here.

This is from the guy who posted recently about struggling to learn React.

I don't buy it.

ReactJS is a power tool and it takes some learning.

If your primary concern is about your initial learning curve then you should look elsewhere such as VueJS but I'm glad of the power of ReactJS.

Changing class to className is not a big deal, nor are the minor other bits and pieces mentioned in the post.

We're talking about two totally different programming paradigms here. The end product might be the same but it's more of a question about how you arrive there.

With JQuery you're signing up for manual DOM manipulation. It's a challenge to scale that for what's now considered table-stakes for web apps.

i just find it amusing that everyone gets up in arms what Brad Frost struggles with in React because he's famous. news flash: hundreds of devs face these issues every day and figure it out. Brad is famous and has problems with React; that's fine. He'll figure out a way that works for him. Doesn't mean his opinion at all reflects the experience of the thousands of devs who are happy with React. Let's move on and talk about more interesting things.

Vue is for enhancing web pages.. you can do applications, but they get very complex beyond small-mid sized apps.

React is made for building web-based applications. You can do small stuff with it, but it's often overkill.

Just because you can use a butter knife to turn a flathead screw, doesn't mean it's the right tool for the job. These days I might reach for Vue as a jQuery stand-in, but more likely, I'd use a smaller jQuery-like library, or just use straight vanilla JS, or other micro libraries. For anything big enough to deserve a build process React is absolutely my first choice.

Vue can be used to enhance web pages, but it works equally well if you want to build a large application. This was one of the design goals. Something that you can start small and scale up with that works equally well for both. If you use the Vue CLI you can have a setup with a router and build tools and setup something very similar to create react app.

<3 jQuery, maybe nostalgia talking but still one of my favorite pieces of software ever. Made DOM manipulation fun.

> Made DOM manipulation fun.

same! Jquery is still quite useful and powerful. This is also what rails does for me; makes web development fun. Or highcharts making charts fun, or elasticsearch making search fun. To me that's a testament to elegantly solving a problem. I just don't get those fuzzies with react.

The JS world is so much more hype driven than say ruby, every few months they will have a new framework that promises to solve all the problems in ui land or the backend. They write songs in its praise everyone worships it like this is the one true framework a panacea for all evils. And then when the hype cycle winds down a new framework emerges. I am totally bored of looking at this cycle for the past few yrs. This just leaves a ton of unmaintainable projects in its tracks because the devs have found a new toy to play with. I have seen clients struggle to find backbone devs because no body in interested in Backbone this is a repeated pattern among JS Devs.

JQuery -> Backbone -> [Tons of Backbone wannabe's written in Coffeescript Batmanjs/Bananajs/what not..] -> Angular -> [Angular lookalikes with tons of magic] -> Ember -> Meteor -> React -> Vue -> [Wait a few months new framework in the Pipeline].

Unfortunately very few want to agree to the truth.

This just isn’t true. React has been going strong for 4 years with no sign of slowing down.

I dont disagree, React has some solid underpinnings but for now VUE has some momentum, till the next one comes along. Google gave up on the idea long back. Google develops Angular but doesnt use it in any of their core products. They themselves use Google Closure library for gmail or word processor.

Actually the product that makes Google the vast majority of it's money is written in the Dart variety of Angular(AdWords)

Reference: https://youtu.be/-HUHRRYQl5k?t=2m4s

Isn't the new YouTube website running Angular? Please don't shoot me if I'm wrong, I don't have any citations, I just presumed (on phone, too lazy to look up).

Not according to Augery (angular chrome extension), but not sure if all evidence can be built out of the result.

However, mobile.twitter.com and facebook proper are using react. Along with Walmart.com and many, many others.

The biggest Angular app I've seen is probably grubhub, and there's some painful state bugs there... in fact I don't think I've ever seen an angular app (not using rxjs or redux) that doesn't have weird state management bugs.

I tried using Angular 1 when it came out and it seemed like too much work to learn for such a small benefit. I started learning React at the start of last year and have found it phenomenal. I am not comparing the two, let alone arguing in favour of Angular. I just thought with the swap to Material Design (and async loading data and components) in YouTube, that they were using Angular. Your opinion about YouTube using Angular (or not) has more citation and authority than mine, so I will assume in the future that YouTube does not use Angular (without certainty, of course).

YouTube was originally built on SPF: https://github.com/youtube/spfjs. Not sure what they're using these days.

Brad Frost has significant social capital and influence. That's the only reason this charlatanry is given the time of day.

Sort of tangential, but React is way less painful with TypeScript/tsx. I combine that with an IntelliJ IDE (RubyMine specifically) and honestly, it's a lot of fun to write web apps this way. (Maybe that's because I come from an iOS background?)

Anyway, I recommend giving this setup a go.

My first foray into React was done using Typesctipt. The functional nature of React plays very very with the static typing of TypeScript.

Just skip React and Vue and go straight to ReasonML/React, you will end up there in 3 years anyway

Had that worked well for you? Is it mature enough to use today?

As a member of a busy, small team with a Rails app and a jQuery heavy front-end... I agree. We use React in a few places and wanted to simply introduce it slowly and "convert to React where we could". It simply has not worked out for us. We have typical server side rendered HTML that has been progressively enhanced with sprinkles of JS (jQuery + various plugins). We do not and cannot book much developer time for refactoring and can only really improve the code itself in bits using the "boy scout rule" (leave the area you're working on better than you found it). For us, it turns out that yanking out chunks of jQuery and replacing them with React did not work out very well.

Thanks for sharing, this is exactly what I am considering doing at the moment.

Any thoughts on https://news.ycombinator.com/item?id=17213264?

For us the difficulty is that with React you need to let React control it's piece of the DOM. We have lots of jQuery UI components. For example, we use Select2. So let's say a dev tries to redo a jQuery heavy form in React. It's mostly fine but there's a Select2 component in there and some WYSIWYG jQuery plugin on a text area. You can't just initialize those with the React component because React will complain about jQuery touching the DOM it controls. So now you either have to find React versions of those jQuery components or properly wrap the jQuery components you have with React which, IMO, can be a bit funky and ends up feeling kind of wrong. Basically, you can end up down a rabbit hole. If you're intention is to truly modernize you're JS and your happy to rip out old jQuery plugins and make changes like that then it's fine. We just didn't have the dev budget to always be doing that.

This comes from a well-known and respected thought leader. There are different types of thoughts, though. This is simply an observation:

> Don’t @ me I’m not trying to start a controversy. I’m only stating an observation.


React, like jQuery, could have done more to keep people from writing bad code. With React, they made the same mistake that Angular did, which was to impose strict rules on all developers. Vue, to its credit, doesn't make this mistake. It's much less opinionated about state management.

> This comes from a well-known and respected thought leader.

I don't disagree but will push back slightly on the appeal to authority. I think in JS land we're getting a little too carried away with celebrity developers (I often joke about "what would Dan Abramov say?" and it's only half-joke). I've been trying hard to focus on the ideas, without regard from who said it.

They should done more to keep people from writing bad code, they should have less rule.

What does that even mean?

In this case, doing more means responding to the real-world usage of React, and making it so that lifting state up isn't the only recommended option. Vue did this and is grabbing some market share from React. https://reactjs.org/docs/lifting-state-up.html

Since early in my career when hiring I've found developers who only know 'jQuery / Angular / Vue / React' but not the underlying Javascript, I swear "x is the new y" is said every time a new framework gets 6 months into vogue.

>Since early in my career when hiring I've found developers who only know 'jQuery / Angular / Vue / React' but not the underlying Javascript

It's frightening, the degree to which many professional web app developers do not know the fundamentals of Javascript. Our technical interview starts out with ridiculously simple questions and gets progressively more difficult and esoteric. And a dismayingly high number of candidates don't get past the first couple of questions. And these are people with years of experience and at least some of the hot JS frameworks on their resume.

> React is a big commitment. I guess that’s why I’m still struggling to comprehend why so many organizations are so eager to take the sturdy, foundational layer of the frontend stack and rewrite it all in a proprietary format.

There’s nothing proprietary about React. It’s all open source. MIT licensed. If you don’t like Facebook’s implementation, there’s like a dozen re-implementations. Hell, a modestly competent software developer could write his own implementation of React in a few days of work.

All else being equal, I’d say a React code base will be less of a maintenance hassle in the future, than the spaghetti mess you usually get when trying to write complex applications with jQuery (been there, done that).

I like to shit on jQuery like anybody else, but it did have its place in the world. It was totally abused by people, but that doesn't make jQuery bad per se, any more than PHP or JavaScript is bad. Yes, I avoided using those things as much as I could, and I much prefer other tools, but they are tools nonetheless. Bad programmers and nontechnical people posing as programmers can abuse well-loved and efficient tools, too. Have you ever seen code written by a noob embedded "engineer" who decided to write their weekend side project in Golang? It's as much a fucking disaster as any of the bad PHP or jQuery stuff out there.

JQuery is a great tool, it got a lot of buzz and people started to abusively use it out of its nominal scope. This does not say anything about jquery, only about people. React is having a lot of buzz, and the same abuses happen in places where it is nowhere needed. Same cause, same symptoms.

You can replace jquery/react with any technology or concept, OO programming, functional programming, MVC, blockchain, machine learning, and every technology or concept having its momentum is or will be misused in some way at some point.

This happened, is happening, and will always happen.

I am learning to code and a newbe.

I think jQuery != react.

I do not understand, why experienced people like to compare jQuery with react when both the lib have different goal ? And show that jQuery is bad.

React can be used with jQuery for DOM manipulation. Described in react doc (https://reactjs.org/docs/integrating-with-other-libraries.ht...).

Shall I learn jQuery at all ? Please, guide me.

The comparison Sara made was that React can be overused just as jQuery was.

The problems with jQuery is that it's mostly a set of functions to simplify Ajax and DOM manipulation so it's not really helpful for the structure of an application.

React (and other frameworks surch as Angular, Ember and Vue), on the other hand, helps you to build reusable component which helps a lot to scale.

Also jQuery's golden age was when browser compatibility was a big issue, nowaday, most browsers behave properly.

There's no harm in learning jQuery, its interface is way more intuitive than native DOM apis. It could be a good idea to try and build a simple app with jQuery and see what are the pain points and then compare with a modern framework.

My only advice to people today would be to use one of the much smaller jquery-like libraries for DOM interaction/events and fetch (shimming ie11) instead of other wrappers.

I wanted to try and address the points Brad makes and as well as clear up some of the misunderstandings in his post. Take a look https://medium.com/@dmitrigrabov/react-is-not-the-new-jquery...

vue seem to be an evolution of react and angular.

it is as if some react developer sat down and said, “how can we make this even simpler so that even my grandson can do it.”

i appreciate when we have guys like the authors of Vue come forward driving the community and taking web development to the next level giving us a more elegant solution.

More like a cousin... I see Vue as a nice component system for smaller applications, I don't think I'd want to build anything of even moderate complexity with it.

React is for building applications, especially with teams. Combined with redux and a handful of other pieces, it's very nice.

Angular, I don't get why anyone would choose it today (I've said it time and again).

I disagree. I would imo recommend you to switch to Vue if your app have gotten too big with React. As I said, Vue is more elegant and it improves the speed of development which also means less errors.

There are many big companies and startups who switched to Vue and loving it so I would say your point is moot.

Facebook is probably the single most interactive and complex application out there... it's using React. There's also more to it than just the UI portion... there's also state management, and the unidirectional workflow, that you don't get in nearly as consistent a way with Vue as say Redux.

Startups will use whatever is trendy. I'm unaware of any site the size of Walmart.com or twitter's mobile site, or Facebook that uses Vue.

Just because you disagree does not invalidate my point.

Nitpicks aside, it seems to me that React/Vue are only/mainly useful for two-way data binding. If it's just one-way binding (i.e. JSON to template), then jQuery with something like Handlebars will be just fine. Correct me if I've misunderstood.

React and Vue are immediate mode/declarative UI libs. Your code says "given the model/state, here's what I'd like the UI to look like right now", and they manage to mutate the DOM efficiently to achieve what you want.

jQuery and the plain DOM are retained mode APIs. You manipulate stateful objects to achieve your goals. It is ok for simple interactions, but it quickly becomes unmanageable for more complex apps.

Coming from a background of doing embedded Javascript work(not web) I found React surprisingly easy to work with and joy to write code in.

React feels like writing normal Javascript.

Vue is very easy to embed into existing web page but feels like learning a new DSL instead of regular Javascript.

> I’m still struggling to comprehend why so many organizations are so eager to take the sturdy, foundational layer of the frontend stack and rewrite it all in a proprietary format.

it's about workforce and durability of the platform

Mods, can we change the title? The current title was clearly chosen to be inflammatory. Meanwhile, the original title only mentions VueJS, not React: "Replacing jQuery With Vue.js: No Build Step Necessary"

I don’t really agree for various reasons. That said, I’m not a huge fan of react, but am stuck working with a few code bases that use it.

I prefer vue, but I dislike that it’s essentially a one man show.

Vue isn’t a one man show. It has a sizable team behind it.

> essentially

And when compared to React, he's absolutely right.

Does React or other cool frameworks have alternatives to jQuery UI components or you need to build your own calendars,dropdowns, accordions.

React has everything (calendars, dropdowns, accordions and so on).

Can you link to the official repository? last time I checked you had to find something on github that mostly were incomplete and the best components were jQuery wrappers

That's an incredible compliment.

jQuery in terms of popularity? I'd take it as a compliment.

This guy is such a phony.

The microwave oven is the new swiss army knife.

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