在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 />。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |