-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[v6] Link no longer supports component prop #7598
Comments
#7409 was working on this. |
Thanks for the link! This issue gives a more convincing argument for re-adding the In my case, I cannot directly modify the |
This comment has been minimized.
This comment has been minimized.
Note that there is some concern over the utility of this prop, which I tend to agree with. I think if we end up implementing this again, we pass both the |
I agree that adding that boilerplate to every custom |
Addressed in #7998 |
* Add support for `useLinkClickHandler` and `useLinkPressHandler` hooks * Add tests * Resolves #7598
Version
6.0.0-beta.0
Test Case
On RR v5, the Link component supported a
component
prop that specified the element to render the link with. It defaulted toa
.Many use component libraries that provide styled anchor links with their own styles, but now there's no way to replace the
a
element.See https://github.com/ReactTraining/react-router/blob/81a5079bf90da0741a61001297926113b112b1d4/packages/react-router-dom/index.tsx#L256.
The migration guide suggests
component
was renamed toas
, but that doesn't work either.Alternatives include making the styled components wrap an anchor child, but:
Steps to reproduce
Expected Behavior
<a href="bar" class="foo">Something</a>
is rendered to the DOM.Actual Behavior
<a href="bar" component="[object Object]">Something</a>
is rendered instead.TS now errors because
LinkProps
doesn't contain acomponent
prop.The text was updated successfully, but these errors were encountered: