I'm a software developer who writes about Laravel, JavaScript, Rails, Linux, Docker, WordPress and the tech industry. Follow me on Twitter @tylerlwsmith
I still use jQuery with WordPress, and I don't expect that I'll stop any time soon. Most of the time a Wordpress plugin will need to load jQuery anyway, and it's really nice for sprinkling JavaScript onto a static page. I write less code than I would with Vanilla JS, and it has animations & ajax built in. Sure, I could piece animations & ajax together another way, but I don't see the reason when jQuery has both.
I'm not a luddite: I use React when I build full-blown web applications. I've also used ES6 features to build apps with Vanilla JS before. But unless bundle size is a major constraint, I still feel perfectly happy reaching for jQuery in 2021.
I wrote about this more extensively in my article with the clickbait-y title, "Hating jQuery doesn't make you cool." Link below 😊
I'm a software developer who writes about Laravel, JavaScript, Rails, Linux, Docker, WordPress and the tech industry. Follow me on Twitter @tylerlwsmith
I sure do. Fetch is too low level for my taste: I don't like having to parse the response for the HTTP code to decide how to handle errors. I almost always prefer jQuery's ajax() method or the Axios library for ajax instead of raw fetch requests. They handle a bunch of things automatically that I'd have to code myself with fetch.
I'm a professional PHP, Python and Javascript developer from the UK. I've worked with Django, Laravel, and React, among others. I also maintain a legacy Zend 1 application.
Have you looked at Alpine.js at all? I quite like that as a jQuery replacement because:
It's tiny - it and Axios together are still only a fraction the size of jQuery
It provides a more declarative API, largely copied from Vue
These days I don't really like including jQuery by default on new projects because a lot of it simply isn't needed, but at the same time doing a lot of that stuff in vanilla JS can be a chore. Alpine's so far proven to be a good solution for what I used to fall back to using jQuery for.
In the same way I'm doing with Vue.js, drop in the script tag and swap out the JQuery. I'll check out Alpine, Vue I just seemed to "get it" quite quick.
I'm a software developer who writes about Laravel, JavaScript, Rails, Linux, Docker, WordPress and the tech industry. Follow me on Twitter @tylerlwsmith
I'm a developer particularly focussed on accessibility and frontend web performance. Outside of work I'm interested in science, the environment, bouldering, and bikes.
Location
Manchester, United Kingdom
Work
Lead frontend engineer at Co-op in the United Kingdom
I'm a software developer who writes about Laravel, JavaScript, Rails, Linux, Docker, WordPress and the tech industry. Follow me on Twitter @tylerlwsmith
Alpine is absolutely amazing. It's become my favorite tool for adding interactivity on server-rendered apps that I build with frameworks like Laravel. And Alpine recently added an equivalent of jQuery's slideToggle(), which is the feature I needed most often from jQuery.
I'm not terribly concerned about the extra kilobytes I get from using jQuery. jQuery doesn't block the DOM from rendering, and it doesn't require activation bootstrapping the way that a framework would: it just needs to download and parse. It's very different than React where you can't render anything until the library is downloaded, parsed, and your app code executed. Even server-rendered React has issues with links not working until the app is fully hydrated.
Avoiding extra kilobytes is nice, but it's easy to go down a rabbit hole where we focus on reducing the kilobytes of JavaScript because it's easier to measure than other higher-impact UX like avoiding page jank, creating useful error states, avoiding responsive issues, etc. Alpine feels nicer to use in a lot of cases though!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I still use jQuery with WordPress, and I don't expect that I'll stop any time soon. Most of the time a Wordpress plugin will need to load jQuery anyway, and it's really nice for sprinkling JavaScript onto a static page. I write less code than I would with Vanilla JS, and it has animations & ajax built in. Sure, I could piece animations & ajax together another way, but I don't see the reason when jQuery has both.
I'm not a luddite: I use React when I build full-blown web applications. I've also used ES6 features to build apps with Vanilla JS before. But unless bundle size is a major constraint, I still feel perfectly happy reaching for jQuery in 2021.
I wrote about this more extensively in my article with the clickbait-y title, "Hating jQuery doesn't make you cool." Link below 😊
Hating jQuery doesn't make you cool
Tyler Smith ・ Jul 27 '20 ・ 3 min read
Do you prefer ajax to fetch for some particular reason? as BE dev I'm bit lost in these things, so I will be glad for more insigth into this :)
I sure do. Fetch is too low level for my taste: I don't like having to parse the response for the HTTP code to decide how to handle errors. I almost always prefer jQuery's ajax() method or the Axios library for ajax instead of raw fetch requests. They handle a bunch of things automatically that I'd have to code myself with fetch.
Have you looked at Alpine.js at all? I quite like that as a jQuery replacement because:
These days I don't really like including jQuery by default on new projects because a lot of it simply isn't needed, but at the same time doing a lot of that stuff in vanilla JS can be a chore. Alpine's so far proven to be a good solution for what I used to fall back to using jQuery for.
In the same way I'm doing with Vue.js, drop in the script tag and swap out the JQuery. I'll check out Alpine, Vue I just seemed to "get it" quite quick.
Alpine has almost everything I like about Vue without the build the steps. It's one of the best front-end tools to come out in the past few years.
Yep with the cdn script there is no build for Vue either so fully with you on such a low impact way to improve
vuejs.org/v2/guide/installation.ht...
+1 for Alpine, I love it when working with server rendered pages.
Alpine is absolutely amazing. It's become my favorite tool for adding interactivity on server-rendered apps that I build with frameworks like Laravel. And Alpine recently added an equivalent of jQuery's slideToggle(), which is the feature I needed most often from jQuery.
I'm not terribly concerned about the extra kilobytes I get from using jQuery. jQuery doesn't block the DOM from rendering, and it doesn't require activation bootstrapping the way that a framework would: it just needs to download and parse. It's very different than React where you can't render anything until the library is downloaded, parsed, and your app code executed. Even server-rendered React has issues with links not working until the app is fully hydrated.
Avoiding extra kilobytes is nice, but it's easy to go down a rabbit hole where we focus on reducing the kilobytes of JavaScript because it's easier to measure than other higher-impact UX like avoiding page jank, creating useful error states, avoiding responsive issues, etc. Alpine feels nicer to use in a lot of cases though!