TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to avoid common SPA pitfalls when using third-party plugins

66 点作者 gandalfar超过 9 年前

10 条评论

unit91超过 9 年前
I liked his examples, though I disagree with his conclusion (don&#x27;t use jQuery). It seems like the real conclusions are:<p>1. understand the language you&#x27;re using (this would solve the `bind` examples); and<p>2. learn how to use your libraries properly.<p>Otherwise, the &quot;don&#x27;t use $TOOL, because misuse can cause $BAD_THINGS&quot; line of thinking is nearly limitless in its application (jQuery, cars, circular saws, ...).
评论 #10976582 未加载
评论 #10976664 未加载
jonesb6超过 9 年前
Most of OP&#x27;s complaints come from the misuse of JQuery, including compounded performance issues when paired with a SPA framework (in this case Ember, which IIRC has a dependency on JQuery either way). Slow + Slow = More slow.<p>Honestly it&#x27;s a library. Use it, don&#x27;t use it, replace it, it honestly isn&#x27;t worth a million identical arguments. People like to use JQuery as a microcosm for bad javascript practices but guess what JQuery didn&#x27;t make you do it! It&#x27;s just a library.<p>There is no real reason to avoid JQuery. Sure you should, as a good developer, explore alternative solutions for different problem sets. Maybe those alternatives become the standard for your team, maybe they don&#x27;t. But unless you made a meaningful discovery that can add to the conversation, you don&#x27;t need to make another blog post about it. Ugh.
评论 #10976809 未加载
评论 #10976655 未加载
Bahamut超过 9 年前
Most of the advice sound like basic JavaScript - avoid things that prevent the interpreter from garbage collecting.
评论 #10976802 未加载
GavinMcG超过 9 年前
What was the fake reason to avoid jQuery?
评论 #10978084 未加载
评论 #10976789 未加载
SimeVidas超过 9 年前
“<i>Some people</i> write crappy jQuery code → jQuery is bad for <i>you</i>.” Never gets old :P
EugeneOZ超过 9 年前
jQuery is not jQuery plugins. It&#x27;s ... not smart to write about them like it is one monolith thing.
评论 #10976810 未加载
frandroid超过 9 年前
I think the title is a bit short. It should have been &quot;The real reason to avoid jQuery with SPA frameworks&quot;.
评论 #10976834 未加载
WA超过 9 年前
tl;dr: Use jQuery + plugins, if you want to do some small UI improvements in JavaScript and don&#x27;t make it too complicated.<p>Learn a lot more about jQuery, if you write complex JS applications (like single-page apps) with the help of jQuery.
评论 #10976697 未加载
ars超过 9 年前
None of this is about jQuery - you can have the exact same problems in native JavaScript.<p>This page should be titled: &quot;Don&#x27;t forget to delete unused JavaScript things (nodes, events, etc)&quot;.
Khao超过 9 年前
The real reason to avoid single page apps.
评论 #10976575 未加载