Unhandled Rejection (TypeError): Cannot read property 'refetch' of undefined
Author: tronxdevCreated Feb 27, 2020Updated Jul 10, 2020
Hello friends,
Today I faced an issue with GraphQL in my React.js project. What I tried to do is refetch a query once a mutation is completed. My codebase is as below
const getUserTeamQuery = useQuery(getUserTeam(usersFragment))
const data = get(getUserTeamQuery, 'data.getUserTeam')
const [updateUser] = useMutation(updateUserMutation(usersFragment), {
onCompleted: () => {
getUserTeamQuery.refetch()
}
})
const updateTeam = async () => {
updateUser({ variables: { input: { pullTeam } } })
}
Is there any solution to fix the issue?
Source: apollographql/react-apollo