Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When no routes are defined, <Link> still uses routing #76

Open
atombender opened this issue Aug 11, 2014 · 4 comments
Open

When no routes are defined, <Link> still uses routing #76

atombender opened this issue Aug 11, 2014 · 4 comments

Comments

@atombender
Copy link

We have an application where we use <Link> extensively. We embed fragments of this app in external custom sites, using scripts or iframes. In that case, the fragment will use <Link>, but there will be no router, since the whole app isn't running; we don't control the page itself, so we can't install any routing, use pushState() etc.

Unfortunately, it looks like <Link> will always involve the routing machinery, even if there is no connection between the environment and a router. I could install a custom environment that simply set window.location, but that seems like an awkward solution for something that should be simple: When there is no routing going on, <Link> should simply behave like <a>.

@sunetos
Copy link

sunetos commented Aug 30, 2014

In those other projects, instead of using Link from this package, can you just alias Link to React.DOM.a?

@atombender
Copy link
Author

Not sure what you mean by "other projects". There is just one app. Currently we use our own custom Link component that detects whether routing is currently available, and uses <a> otherwise. But this should be unnecessary.

@sunetos
Copy link

sunetos commented Aug 31, 2014

"Other projects" => "external custom sites". Sounds like you're already covered with your Link component. Could you take the logic from your custom Link, paste it into the main Link, and make a Pull Request?

@atombender
Copy link
Author

No, my custom link component depends on a global boolean in my app, set at start time — it has no idea whether routing has actually been set up inside react-router-component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants