当我尝试在用户简化程序中更改状态时,出现不必要的屏幕更改。我不知道为什么会这样,并且我的代码中没有任何内容引起屏幕变化。
//The users reducer
case "UPDATE_USER":
state = action.user;
return state;
default:
return state;
//This is the class that is calling the action
componentDidMount() {
// Updates your user data after the match ends... This is when you are still on the rating screen
this.props.socket.getSocket().on("iWasRated", user => {
alert("I was rated");
this.props.dispatch(handleUpdateUser(user));
this.props.socket.getSocket().off("iWasRated");
});
}
当调用dispatched时,redux状态应该只是改变并且不应该进行导航。当redux状态更改时,它将带我到另一个屏幕。我在做错什么吗?