Accessing onError, onSettled in the component the mutation was called
I am making a mutation where if there is an error, I want to change something in the component where the mutation was called. How can I access this error state in the component? I want to show a message in the component that there was an error (instead of a snackbar)
1 Reply
jolly-crimson•3y ago
const { error } = useMutation()
like, the error is returned from useMutation so you can render something depending on it. Very similar to useQuery in this regard