【发布时间】:2019-05-05 12:26:13
【问题描述】:
这是我扩展组件的方式:
const ComponentWithMutation = graphql(GQL_MUTATION_ACTIVATE,
{
options: (props) => ({
variables: {
foo: props.foo,
bar: props.bar,
},
}),
})(ActivateEmail);
现在在组件内部:
class ActivateEmail extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
const { match, mutate } = this.props;
mutate({
variables: { token: match.params.atoken },
});
}
render() {
return (
<div>
// I need to access data, error, loading here...
</div>
);
}
}
我想访问data, error, loading。我如何在render 方法中做到这一点?
【问题讨论】:
标签: javascript graphql react-apollo apollo-client