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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

How we achieved 51% efficiency in button loading speed

4 点作者 isaacjohnwesley大约 7 年前

2 条评论

onion2k大约 7 年前
Maybe there&#x27;s a reason to put all that effort in to make a single, generic component but it leads to a list of &#x27;if statements&#x27; to build up a set of styles where a lot of them are mutually exclusive - a button can&#x27;t be both a Google style button <i>and</i> a Facebook style button - and the code doesn&#x27;t have any checks for that.<p>It&#x27;d be a lot easier (not to mention likely faster) to build the styles in SCSS and just pass in a list of what&#x27;s needed directly to the button&#x27;s className prop as a string, eg className={&quot;link lined google large&quot;} with CSS rules for .link, .google, .lined, and .large that override styles from the previous class as necessary.
评论 #16958543 未加载
mtmail大约 7 年前
direct URL <a href="https:&#x2F;&#x2F;medium.com&#x2F;the-inkmonk&#x2F;how-we-achieved-51-efficiency-in-button-loading-speed-86c786ef8e6d" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;the-inkmonk&#x2F;how-we-achieved-51-efficiency...</a>