onCompleted not working inside of useMutation #6
Rollo-the-coder
started this conversation in
General
Replies: 1 comment
-
Solved it... had my styled component for the form marked with styled.div not styled.form. haha what a headache. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am not getting any errors running the code. But it seems that onCompleted is not ever being triggered inside of useMutation. As well I see across the web many topics talking about this and stating they don't work together or that there is a bug...
Sources talking about it not working:
https://spectrum.chat/apollo/react-apollo/oncompleted-not-firing-when-passed-as-an-option-in-usemutation~30d777c5-954e-4e96-b0ad-85f6660a4d98
https://www.tutorialguruji.com/react-js/oncompleted-callback-in-usemutation-doesnt-have-return-values/
The book is instructing me on page 159 to console.log the data. But since onCompleted is never triggered nothing inside of it is ever logged.
Any help would be much appreciated!
const [signUp, { loading, error }] = useMutation(SIGNUP_USER, {
onCompleted: (data) => {
//logs the JSON web token when mutation is complete
console.log(data.signUp);
},
});
Beta Was this translation helpful? Give feedback.
All reactions