简体   繁体   English

SPA 中的按钮与链接,例如 React

[英]Button Vs Links in a SPA such as React

Which one should I use inside a SPA application??我应该在 SPA 应用程序中使用哪个? Considering the user Experience.考虑用户体验。

I have designed my applications using React with some personal rules, but which one would be the right way to use?我使用 React 设计了一些个人规则的应用程序,但哪一种是正确的使用方式?

Buttons:按钮:

  • For small actions (close a tooltip, a notification badge...)对于小动作(关闭工具提示、通知徽章...)
  • With forms带表格
  • When you don't need to worry with event flows当您无需担心事件流时

Links链接

  • To change a route / page更改路线/页面
  • Anchor links锚链接
  • Link inside texts文本内链接

Like I said, getting confuse here to distinguish the use and purpose of each one.就像我说的,在这里混淆以区分每个的用途和目的。

Generally, my distinguishing factor is that Buttons execute an action whereas Links navigate you to a different portion of a website, generally undoable with the back button.通常,我的区别因素是按钮执行操作,而链接将您导航到网站的不同部分,通常可以使用后退按钮撤消。

Some common Buttons:一些常见的按钮:

  • Save Button (on a form)保存按钮(在表单上)
  • Post Your Answer (stack overflow question answer)发布您的答案(堆栈溢出问题答案)
  • Log In登录
  • Send Email发送电子邮件

Some Common Links:一些常见的链接:

  • Home, Profile (facebook)主页,个人资料(脸书)
  • Questions (stack overflow)问题(堆栈溢出)
  • Notifications (twitter)通知(推特)
  • Popular (reddit)流行(reddit)

As a metric for which to use, I usually like to ask if the thing I'm doing would be able to be undone with the back button on the browser.作为要使用的指标,我通常喜欢问我正在做的事情是否可以通过浏览器上的后退按钮撤消。 You can't "back button" a login request, or a tweet, but you can "back button" navigation to your profile on facebook or a link on reddit.您不能“返回按钮”登录请求或推文,但您可以“返回按钮”导航到您在 facebook 上的个人资料或 reddit 上的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM