阿波罗 resetStore 不起作用
Apollo resetStore doesn't work
请帮忙;
我有一个错误“undefined is not an object (evaluating '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));
您可能需要将组件的作用域显式绑定到函数。
class FeedProfileBottom extends Component {
constructor (props) {
super(props);
this._onLogoutPress = this._onLogoutPress.bind(this);
}
// ...
请帮忙; 我有一个错误“undefined is not an object (evaluating '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));
您可能需要将组件的作用域显式绑定到函数。
class FeedProfileBottom extends Component {
constructor (props) {
super(props);
this._onLogoutPress = this._onLogoutPress.bind(this);
}
// ...