Using Link with another Component like Buttons
See original GitHub issueLets say I have a component called MyButton
. Is there a quick way to attach link behaviour to it without writing an onClick handler for every button?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Wrapping a react-router Link in an html button - Stack Overflow
LinkButton component - a solution for React Router v4 ... First, a note about many other answers to this question. ⚠️ Nesting <button>...
Read more >How to use a Button as a Link in React | bobbyhadz
To use a button as a link in React, wrap the button in an <a> tag or a Link component if using react...
Read more >How to Use a Button as a Link in React - Coding Beauty
To use a button as a link in React, wrap the button in an anchor ( <a> ) element. Clicking a link button...
Read more >How to use a Button component as a link in React
To correctly use a Button component as a link in React, override the underlying button HTML tag of the component and turn it...
Read more >Using Link with another Component like Buttons #1176 - GitHub
Lets say I have a component called MyButton. Is there a quick way to attach link behaviour to it without writing an onClick...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t like this approach but if you absolutely need this, you can set up a top-level document link handler like here:
However, in my opinion, it’s kinda strange to have some link components out of your control that nevertheless link to the internal routes in your app.
we provide
Link
as a router-aware href, and mixins that have everything that link uses to work, so you can build whatever elements you want that interact with the router.