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?5 Replies
flat-fuchsia•2mo ago
link is not meant for external links
use an <a> for that
deep-jadeOP•2mo ago
ah ok 👍
xenial-black•3w 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•3w 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
xenial-black•3w 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...