Blog Discussion: What's the best modern JavaScript jQuery replacement?

Kentico Community
2024/11/11 9:38 PM

Blog Post: What's the best modern JavaScript jQuery replacement?

Continue discussions 🤗 on this blog post below.

Answers

2024/11/13 8:07 AM

Thank you, Sean, for this article—it really resonates with me! I spend a lot of time writing both client- and server-side JavaScript, so if I may, I’d like to share my perspective on removing jQuery from XbyK and its potential successors.

In the XbyK context, I see jQuery as an unnecessary, render-blocking dependency that only serves to hurt the LCP web vitals metric on live sites. Removing it is definitely a welcome improvement!

When it comes to replacing jQuery, I’m all for using vanilla JavaScript (and CSS). jQuery originally added syntax sugar for easier developer experience (DX) and helped address the lack of standardization across web browsers, which was a bit of a wild west back then. But the languages and browsers have matured so much now that jQuery feels mostly irrelevant. For those who still want that "syntax sugar" feel, Umbrella JS is a nice, lightweight alternative.

Frameworks like React, Svelte, and Vue.js, on the other hand, address different challenges—such as state management, reactivity, and templating—that neither jQuery nor vanilla JavaScript fully solve. Personally, I’d avoid using these in XbyK, as they’re generally better suited for web applications rather than websites.

In server-side frameworks like Next.js, SvelteKit, or Nuxt.js, I could only see these being used alongside an XbyK Headless channel serving data.

Then there are libraries like Unpoly, Swup, HTMX, and Alpine.js, which focus on specific interactive or visual functions, similar to how jQuery plugins once did. Some also bridge elements of state management, reactivity, and templating. For XbyK, these could be useful if you need to add a high level of interactivity. However, it’s important to choose wisely, considering factors like feature set, size, and ongoing support.

As for your question on priorities, I’d always put visitor experience first—making websites fast to load and accessible. When developing sites in XbyK, I’d lean on vanilla JavaScript as much as possible, adding external dependencies only when truly necessary.

2024/11/19 11:18 PM

I'm glad you found the post valuable. I pushed back on my instinct to fill the post with a bunch of example code, which took effort 😅. I hope that if developers are unfamiliar with all the approaches and technologies I mentioned they can research them further and maybe share their thoughts here like you have.

Question: when you use vanilla JavaScript do you ever use any non-rendering libraries? Small tools, or utilities - like day.js or web components?

As for your question on priorities, I’d always put visitor experience first

Great perspective!

To answer this question, you have to login first.