Using suggested method: This is the result: A link in the button, Code in between comment lines
I was wondering if there is a way to wrap a Link
element from 'react-router'
in an HTML button
tag using react.
I currently have Link
components to navigate pages in my app, but I would like to map that functionality to my HTML buttons.
Do wrapping in the reverse way and you get the original button with the Link attached. No CSS changes required.
Here button is HTML button. It is also applicable to the components imported from third party libraries like Semantic-UI-React.
While this will render in a web browser, beware that:
⚠️Nesting an html
button
in an htmla
(or vice-versa) is not valid html