Never ever have I seen active encouragement of poor programming discipline. You are correct in that's what jQuery was about, but it had no opinion on how to go about that task.
It might not have a explicit opinion stated anywhere but in any library or framework, the API provided influences how those APIs are used.
By having the central unit of work start with a query selector is one such influence which I feel implicitly encouraged DOM manipulations.
Taking a look at the original jQuery website on web.archive, this is the introduction to the $() function:
"The functionality of jQuery centers around one central function: $(). Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS or XPath), which then finds all matching elements and remembers them for later use. For example:"
And then goes to show a DOM selection followed by a chained mutation.
> [...] I feel implicitly encouraged DOM manipulations.
That's jQuery's primary job. It isn't DOM manipulation that causes code/architectural issues.
"All" (I'm simplifying) jQuery does is provide mechanisms to select and manipulate DOM. How to organize its usage is an exercise left to the reader, and most readers did it poorly.
It's not jQuery's fault that people wrote shitty code with it. And, in fairness, when Prototype/jQuery/etc. came out, sites were simpler. When people started doing more, if they didn't take control of how they were using jQ/etc., it blew up and made them hate their lives.
At the same time people were doing that, other people were using various organizing principles to tame their jQ/etc. soup, writing tests, and keeping a handle on the sprawl.
You can write shitty code in React, too. It imposes a certain set of conventions that make it harder to want to. Layer on Redux/etc. and it's even harder to want to. Layer on other various conventions and frameworks and you want to even less. But it doesn't stop you--just like jQ didn't stop you from using self-discipline before people smarter than me evolved client-side frameworks to where we are now.
While I wrote my share of jQ soup, I also worked on projects that were flexible, extensible, testable, and clean. The choice is always ours to make.
Take an average developer (or two) and sit them down in front of React and jQuery for the first time. My bet is anything based on React will be better built than that of jQuery.
Of course you can architect those flexible, extensible, testable and clean projects. But straight out of the box you do not get that with jQuery. It requires planning and architecture engineering.
Whereas every React project starts off with those principals.
In other words, the ways people can use jQuery wrong is worse than the ways people can use React wrong.
I both agree and disagree. If you code yourself into a corner with React it can be harder to understand and untangle: it's much easier to understand jQuery under the covers than React, especially if you're using other parts of the React ecosystem.
None of this is related to what I said originally, which is that jQuery doesn't encourage shitty code. jQ's original purpose wasn't to organize developer activity, it was to simplify one tiny portion of it.
> [Good code in jQ] requires planning and architecture engineering.
Precisely what I said.
(That said, if you don't do that with React, you'll still end up with a mess.)
My point about planning and architecture was to contrast it against what I believe React is better at.
Personally I think React is easier to understand. Honestly the vDom is an implementation detail people get stuck on. Pure functions, well defined state owneeship and transition, and so on are the real benefits.
The other main criticism is JSX which is totally optional and mixing implementing with presentation; the "correct" which I believe to be a outdated but still accepted belief that went out of style around Web 2.0. This separation is not required either, you can rewrite render() to pull from any templating engine or whatever. Or use HOF/HOC via the presentation/containener design pattern.
I realize I went off topic but I've been wanting to compiler my thoughts on this.
React is better at enabling planning and architecture; that's part of its job. That was explicitly not part of jQuery's job. jQuery was a tool to be used as part of a larger strategy. Lots of people chose to ignore that part of their code, and paid the price.
I like JSX quite a bit as well; IMO creating an artificial separation between presentation and behavior is not a useful way to think about web apps.
Separating data from presentation and behavior is fine, and is a long-standing GUI tradition.
I think we're really in agreement about everything. The tools have intended jobs; some people use them incorrectly or without regard to best-practices. Both have different strengths and failure modes.
I would say JSX and the separation of presentation / behavior is orthogonal.
JSX is just a Javascript powered embedded SGML-like document.
The combining of presentation and behavior is caused by render() being defined inline with implementation.
You can not use JSX by using ReactDOM directly or a templating library while still keeping render() inlined.
Or you can move render() to another class (or subclassed, or HOC, whatever) and separate the presentation and behavior with or without JSX.
jQuery was all about selecting a node or node list and then applying manipulations to it.