Link `to` urls can't be external but `href` still requires `to`
Using the
start-bare example I am not able to use <Link to="http://...">External</Link because it matches no routes but using href instead I see a complaint about missing to. Did this change and is there a proper way to link to external urls?6 Replies
flat-fuchsia•5mo ago
link is not meant for external links
use an <a> for that
quickest-silverOP•5mo ago
ah ok 👍
vicious-gold•4mo ago
@Manuel Schiller But the Link component explicitly checks for external links, it's just not accepting them on a type-level: https://github.com/TanStack/router/blob/ef74fc661bb82cbc415fcc6645cffcaec9b3b8b7/packages/react-router/src/link.tsx#L88-L94
This would be extremely helpful for custom link components, to have the same styling for internal and external links.
GitHub
router/packages/react-router/src/link.tsx at ef74fc661bb82cbc415fcc...
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router
flat-fuchsia•4mo ago
i agree
@Chris Horobin was looking into this
do we have a GitHub issue for this already?
if not please create one so we can properly track this
vicious-gold•4mo ago
I created it: https://github.com/TanStack/router/issues/4901
(I had to use the bug template because FR just links to GitHub discussions)
GitHub
Link should accept external links · Issue #4901 · TanStack/router
Which project does this relate to? Router Describe the bug The Link component, custom link components created with createLink() and possibly linkOptions() only accept internal links but should acce...
conscious-sapphire•3mo ago
Running into this issue today! Is there a workaround to allow TanStack's
Link to accept internal and external links?