browserHistory.push no navega a la página nueva
He configurado browserHistory en un enrutador con esto (react-router 2.0):
import { browserHistory } from 'react-router'
function requireAuth(nextState, replace) {
if (!services.auth.loggedIn()) {
replace({
pathname: '/login',
state: { nextPathname: nextState.location.pathname }
})
}
}
export default (store) => (
<Router history={browserHistory}>
<Route path='/' component={AppLayout}>
<Route path="login" component={LoginContainer} />
<Route path="map" component={MapContainer} onEnter={requireAuth} />
</Route>
</Router>
);
Entonces estoy tratando de usar browserHistory en react-router para enrutar programáticamente a una nueva página desde una vista, ala:
import { browserHistory } from 'react-router'
...
browserHistory.push('/map');
Esto cambia la URL a / map pero no representa los componentes en esa ruta. ¿Qué estoy haciendo mal?