2

It seems if I change path in root onEnter or onChange hook, the url will change infinite(?_k=u9huwr will always change). But if I change path in child routes, it will work. Actually I want to handle the authentication in one place, otherwise every child route should handle the same logic.

{
    path: '/',
    onChange: function(prevState, nextState, replace, callback) { 
        if(!logined) {
            replace('login');
        }
    },
    childRoutes: [
        ....
    ]
}
jason
  • 1,621
  • 6
  • 21
  • 39

0 Answers0