Replies: 3 comments 5 replies
-
This is still the best answer to external links. Developers should be aware that their links outside of the application have nothing to do with the internal router at all and should reach for the appropriate tag versus using a Link component. You wanted to make sure to always use the came component everywhere, you could write your own that does the check to determine if it is external or internal, and even add some of the safe checks for |
Beta Was this translation helpful? Give feedback.
-
If you need a link component that has the same branding regardless if it's an internal or external link, then you should create one component that can differentiate between internal and external links as suggested by Ryan Florence and add your own branding. Or just create two separate components with your branding, one for external links, one for internal links that wraps around the React Router |
Beta Was this translation helpful? Give feedback.
-
I believe the above comments are outdated—This seems to have changed in January 2023 in #9900
The exact logic can be seen here: react-router/packages/react-router-dom/index.tsx Lines 957 to 971 in 94f7fb7 I've failed to find this mentioned anywhere in the docs, though it is consistent with @mjackson's comment in #1147 (comment) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I can't find anything in the documentation about how to use
<Link />
with external urls. Just found this github issue...#1147
Is it still the case that I need to implement the check myself if it's a
App link
orExternal page link
?I just want to implement a list of urls that are either on our app or link to an external page.
btw the react-router-hash-link is also not implemented?
btw2: The documentation of the router v6 without a search is rather difficult to navigate.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions