question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v6] Link does not have `as` prop

See original GitHub issue

^6.0.0-beta.0

Expected Behavior

https://github.com/ReactTraining/react-router/blob/dev/docs/advanced-guides/migrating-5-to-6.md#rename-link-component-to-link-as-and-navlink-exact-to-navlink-end

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
multimericcommented, Aug 26, 2021

Might be good to update the migration docs to indicate this.

1reaction
graupcommented, Aug 11, 2021

But Link and NavLink do some additional stuff that would be annoying to replicate by hand. How about providing a use{Nav}Link hook that returns all the props that Link/NavLink generates?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found