react redux路由器没有定义

时间:2016-02-01 07:59:21

标签: reactjs redux

export function loginSuccess(response){
    return (dispatch, getState) => {
      dispatch({ response, type: types.LOGIN })
      console.log(getState())
      router.transitionTo("/profile")
  };
}

此时console.log(getState()) router会提供transitionTo对象..但它没有command ="--f=tt --i=3 --s=0" value1 = command.split("--f=",1)[1] value2 = command.split("--i=",1)[1] value3 = command.split("--s=",1)[1] print value1 print value2 print value3 功能。

1 个答案:

答案 0 :(得分:0)

您的router变量未定义。如果getState()包含路由器对象,则需要分配它以便使用它。

let { router } = getState(); 

从现在开始,您可以使用transitionTo方法,因为现在定义了router对象。

相关问题