When building WordPress plugins for myself or others, several of the things I take into account – as we all should – is the level of maintainability, scalability, and support for the plugin as WordPress continues to move forward.
As the support for ES6 continues to rise, jQuery continues to move forward with development, and the desire to use new APIs to build out our solutions, I believe it’s worth asking the question:
Do we really need to stick with jQuery?
jQuery Versus ES6 in WordPress
First, I think it’s important to recognize that at one point in time, jQuery really helped us manage browser inconsistencies but that’s not so much the case anymore. This is primarily because most of the modern browsers support many of the common APIs.
Secondly, even though the browser inconsistency thing isn’t as much as problem as it once was, jQuery still makes it easy to crawl, manipulate, and, ahem, query the DOM in an easy fashion (especially if you conceptualize the DOM as the data structure that it is).
It’s all the same programming language. jQuery just offers an API that ES6 does not and if you need or want that convenience, then go for it.
One More Thing
For now, just remember that the idea of “should I use jQuery because it’s bundled with WordPress or use ES6 because it’s the most modern variant of the language” is not binary.
It’s more of “do I want or need to use ES6 with jQuery?” or perhaps it’s “do I want or need to use jQuery along with ES6?”
Ultimately, I don’t find it worth stressing about it. Instead, I find it worth determining the best course of action for the problem at hand and working from there.