小编Sib*_*ani的帖子

onCompleted 是否与 useMutation 一起使用?

我在反应项目中使用 useMutation 钩子。突变成功运行,但之后没有达到 onCompleted 。

我已经在突变中将 notifyOnNetworkStatusChange 设置为 true ,但这似乎没有帮助。

const [createUser] = useMutation(SIGNUP_MUTATION);

createUser({
  variables: {
     firstname,
     lastname,
     email
  },
  notifyOnNetworkStatusChange: true,
  onCompleted: (data) => {
     // not called
     confirm(data);
  }
});
Run Code Online (Sandbox Code Playgroud)

react-apollo-hooks

6
推荐指数
1
解决办法
4807
查看次数

标签 统计

react-apollo-hooks ×1