【发布时间】:2018-04-26 10:37:42
【问题描述】:
请帮忙; 我有一个错误“未定义不是一个对象(评估'this.props.client')
class FeedProfileBottom extends Component {
_onLogoutPress = function() {
this.props.client.resetStore();
return this.props.logout();
}
render() {
return (
<Root>
<LogOutButton onPress={this._onLogoutPress}>
<LogOutText>
Logout
</LogOutText>
</LogOutButton>
</Root>
);
}
}
export default withApollo(connect(undefined, { logout })(FeedProfileBottom));
【问题讨论】:
-
您是否尝试过将组件范围显式绑定到您的注销功能?
-
@NickZuber 谢谢,成功了。
-
我添加了这个作为对您问题的回答——如果您是这样解决的,您介意将其标记为正确,以便其他有类似问题的人发现解决方案吗?
标签: react-native react-apollo apollo-client