TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How we achieved 51% efficiency in button loading speed

4 pointsby isaacjohnwesleyabout 7 years ago

2 comments

onion2kabout 7 years ago
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 未加载
mtmailabout 7 years ago
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>