-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
"Navigating Outside of Components" - Invalid Example or Title of Article #3062
Comments
I think the intention of that documentation is to illustrate something more like this.context.router.push. Maybe it's time to ditch the guides and just rely on API docs so they can stay consolidated? |
This is correctly documented. The exported |
You can see that
|
I see. I can't understand what this article is attempting to illustrate then - why would you want to push something onto the browser history, but not actually trigger a route change? When you call browserHistory.push, you can watch the URL bar change but the route doesn't trigger a new view. When you call this.context.router.push, the router does trigger a new view. It is possible that this is just a bug in my application - I will try to create a use case to illustrate. But from what I can see, if I am on /home and call browserHistory.push('/'), it will change the URL bar, but the Route for / will not be rendered. However, if I call this.context.router.push('/'), the Route for / will render. |
That's not true. This works as expected, assuming you're using React Router 2.0. The singletons didn't exist in 1.0 or earlier. Make sure you're using the 2.0 version we released last night. |
@timdorr Thank you - I was using the rc5 version of react-router 2.0.0 and having this issue. I have upgraded to react-router 2.0.0 and still observe the same behavior. If I am on http://localhost:3000/home
I will isolate react-router and verify this isn't an issue with my application. |
I think / am almost sure this is actually a middleware issue having to do with the fact that the boilerplate app I used is bypassing react-router browserHistory and using an external history. Sorry to bug you about it! |
Sharing this in case it may be helpful for somebody: I was experiencing a similar behaviour as the one described by @netpoetica. In my case I am using It may be worth to add to the documentation that |
In the documentation for "Navigating Outside of Components", the author recommends using browserHistory.push to redirect to another route. However, this will not actually trigger react-router to go to the new route - it will just push it into the browser history and change the URL bar without redirecting. Is this intentional?
My expectation is that this example would show you something more like router.redirect('/'), etc.
The text was updated successfully, but these errors were encountered: