I have api call that looks like
const getMutationService = () => {
return {
createMeme: async (
_private: string,
templateId: string,
file: Blob,
memeText?: string,
title?: string,
tags?: Array<string>,
): Promise<MemeCreateMemeResponse | undefined> => {
return await memeApi.memePost({
_private,
templateId,
file,
memeText,
title,
tags,
});
},
};
};
and I am calling this in another hook like
const mutationService = getMutationService();
const { mutate: createMeme } = useMutation(mutationService.createMeme);
Its throwing an error of
Argument of type '(_private: string, templateId: string, file: Blob, memeText?: string, title?: string, tags?: Array) => Promise<MemeCreateMemeResponse | undefined>' is not assignable to parameter of type 'MutationKey'.
I have done other mutation calls with the same pattern. Why is this one throwing this mutation key error? Confused
useMutation can only accept one parameter. If you need multiple parameters, please use an object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With