加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

在html按钮中包含react-router链接

发布时间:2020-12-14 21:25:14 所属栏目:资源 来源:网络整理
导读:使用建议的方法: This is the result: A link in the button, Code in between comment lines 我想知道是否有办法使用react在HTML按钮标记中包含来自’react-router’的Link元素。 我目前有链接组件来导航我的应用程序中的页面,但我想将该功能映射到我的H
使用建议的方法:
This is the result: A link in the button,
Code in between comment lines

我想知道是否有办法使用react在HTML按钮标记中包含来自’react-router’的Link元素。

我目前有链接组件来导航我的应用程序中的页面,但我想将该功能映射到我的HTML按钮。


解决方法

是。

你可以这样做:

const WrappedLink = () => {
  return (
    <button>
      <Link style={{display: 'block',height: '100%'}} .... />
    </button>
  )
}

然后使用< WrappedLink />而不是< Link />。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读