I need to write dedicated hook useMutation with onCompleted and parameter onMutationCompleted.
In file it uses like:
const [data] = useClearWorkerMutation({ onCompleted: onMutationCompleted });
I don't know how to put onCompleted
in this hook correctly.
export function useClearWorkerMutation() {
return useMutation<ClearWorkerMutationData, ClearWorkerMutationInput>(
CLEAR_WORKER_MUTATION,
{
onCompleted: (data) =>
},
},
);
}
Per the docs the function signature for
useMutation
is:If the only option is
onCompleted
and you have some query then you would have:It looks as if you're doing this correctly. Are you getting errors? Is your
onCompleted
function not getting executed? What's not working?