rgcalsaverini rgcalsaverini - 1 year ago 183
React JSX Question

React-Router push only changes the URL and does not navigate

I am trying to programmatically navigate using react-router and I can't seem to be able to do so.

I have read other related questions, such as this one that seems to work for everyone else, but to no avail.

I am using react-router version 2.4.1, and to my understanding it should be accomplished by:


or even:

browserHistory = require('react-router').browserHistory;
var browserHistory.push('/');

But with either approaces all I seem to accomplish is a URL rewrite, with no actual routing going on.

I do have a route registered for '/' on my router.

What am I missing? I am inches away from a
window.location = '/'
on what is otherwise a Single Page Application :(

Answer Source

So, apparently a third-party component fiddling with the context and children was to blame. Removed it and now it works as expected.

If anyone is facing this, try to look at how the components on your route are handling context and children.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download