-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: <Link component> #5437
Comments
This has been discussed a number of times and just isn't going to happen. Using anything besides an anchor opens up accessibility issues that React Router does not want to expose users to. If you want this behavior, you can easily clone |
Thanks for the offer of help here, @LazyElephant. I'd like to figure out a way we can help you with this. In the past we had a contributor who was very adamant that we always render a |
This shipped today in 5.1.0 |
Why
TLDR: This will create a consistent interface in both
react-router-dom
andreact-router-native
, allowing code reuse.I just started building an app using React Native/React Native Web with the goal of using 99.9% of the same code. I decided to use React Router with it since both the web and native versions offer the same library components (mostly). This allows me to alias
react-router-native
toreact-router-dom
with webpack, resulting in the correct library being called based on the platform.By adding the 'component' prop to the Link component in
react-router-dom
, cross platform components can be rendered instead of an anchor tag.Example Usage
I already made this change with tests in a forked repo here and the proof of concept project I'm working on is here. If you would like to make this change, I can make a pull request any time.
The text was updated successfully, but these errors were encountered: