[v6] Link does not have `as` prop
See original GitHub issue^6.0.0-beta.0
Expected Behavior
As stated in the documentation, Link
components should have as
prop that allow us to change the corresponding component type
Actual Behavior
https://github.com/ReactTraining/react-router/blob/dev/packages/react-router-dom/index.tsx#L166
Link
does not have as
prop
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[v6] Link no longer supports component prop #7598 - GitHub
In my case, I cannot directly modify the Link component I'm passing to the as prop as it's provided by an external library....
Read more >how to add props in route component in react-router-dom v6
Unless anyone has another answer, there seem to be no such solution. As of react router v6 there is no passing of props...
Read more >Migrating to React Router v6: A complete guide
Migrate your React Router applications from v5 to v6 with this in-depth guide, including a review of additions and improvements from v5.
Read more >React router v6 pass props on Link click - YouTube
In this video, I am walking through React Router v6, mainly using params, passing value from params, and showing the values.
Read more >FAQs v6.6.1 - React Router
Why does <Route> have an element prop instead of render or component ? ... render something when a route // *doesn't* match the...
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
Might be good to update the migration docs to indicate this.
But
Link
andNavLink
do some additional stuff that would be annoying to replicate by hand. How about providing ause{Nav}Link
hook that returns all the props thatLink
/NavLink
generates?