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
How to navigate to new route outside of a React Component #1081
Comments
Nevermind. Looks like the solution is to save the return value from
I would recommending adding this to the docs as it wasn't obvious that the return value of Router.run was actually useful. |
This seems to be kind-of-indirectly documented. Check the |
Is there a better way to do this with in an individual component than assigning it to the global window object? I try to avoid that when possible :) I'm using browserify to bundle my react app and the |
If you're using browserify, you can simply export the return value of
|
Yeah, that was my initial approach, but for some reason browserify is having trouble Really puzzled by why it's not working. Other sibling files of the same kind don't throw an error. At any rate, this isn't a react-router thing as far as I can tell. |
@markthethomas Maybe circular dependency? |
@markthethomas I had the same issue. Place your |
@th0r I thought so too but doesn't seem to be the case based on my different |
Still not working with |
you've probably got circular deps, might need a module/container to register the instance on, then other modules can require that container and ask for it later. |
Good point; I'll try that. Thanks! |
Is it possible to interact with the React Router outside a React Component's context?
For example, let's say I want to have a random Javascript module simply navigate me to the home page every 10 seconds, ie:
The text was updated successfully, but these errors were encountered: