Skip to content
Discussion options

You must be logged in to vote

the mutationKey is right there, where you pass it to useMutation:

const useMyMutation = () => {
  const mutationKey = ['remove-id']

  return useMutation<null, unknown, { id: string }, unknown>({
    mutationKey,
    mutationFn: async ({ id }): Promise<null> => {
      const { data } = await httpClient.removeId(id);

      return data;
    },
    onSuccess: () => {
      console.log('mutationKey', mutationKey)
    },
  }
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bartschriever
Comment options

Answer selected by bartschriever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants