preactjs / preact-router

:earth_americas: URL router for Preact.
http://npm.im/preact-router
MIT License
1.01k stars 156 forks source link

Fall back to native behavior for outbound links #394

Closed teodragovic closed 3 years ago

teodragovic commented 3 years ago

My use case is this: I have an array of nav links where some are local to the app and some lead to other domain.

For non-local links, I force native behavior by doing <Link native={url.startsWith('http')}>.

Would it make sense to do this check on router level? If so, I can make a PR.

developit commented 3 years ago

This is already how preact-router works, just you need to use <a> instead of <Link>.

<Link> is for forcing URLs through the router, most folks should just be using <a href="/"> - any links to external domains will be processed by the browser itself.