Shouldn't a mutation's "then" data always be defined ? #1264
-
Hello, when using a mutation callback, for example : const [result, addTodo] = useMutation(AddTodoDocument);
addTodo({ content: 'test' }).then(({ data }) => someStuff(data)); shouldn't |
Beta Was this translation helpful? Give feedback.
Answered by
JoviDeCroock
Dec 29, 2020
Replies: 1 comment 3 replies
-
No, because your mutation can also error out. This could mean that there’s no data coming back, in general when performing mutations it’s best to check whether or not there was an error and notify the user if so, when there’s data you can decide to continue and perform the func you want. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
JoviDeCroock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, because your mutation can also error out. This could mean that there’s no data coming back, in general when performing mutations it’s best to check whether or not there was an error and notify the user if so, when there’s data you can decide to continue and perform the func you want.