使用建议的方法:
This is the result: A link in the button,
Code in between comment lines
This is the result: A link in the button,
Code in between comment lines
我想知道是否有办法使用react在HTML按钮标记中包含来自’react-router’的Link元素。
解决方法
是。
你可以这样做:
- const WrappedLink = () => {
- return (
- <button>
- <Link style={{display: 'block',height: '100%'}} .... />
- </button>
- )
- }
然后使用< WrappedLink />而不是< Link />。