useMutation: No overload matches this call

Hi, I’m in the React: Intermediate class.

I got the below error message when I used useMuation(). Anyone knows how to fix it?

No overload matches this call.
The last overload gave the following error.
Argument of type ‘{ mutationFn: (data: Todo) => Promise; onMutate: (newTodo: Todo) => { previousTodos: Todo | undefined; }; onSuccess: (savedTodo: Todo, newTodo: Todo) => void; onError: (error: Error, newTodo: Todo, context: AddTodoContext) => void; }’ is not assignable to parameter of type ‘MutationKey’.
Object literal may only specify known properties, and ‘mutationFn’ does not exist in type ‘readonly unknown’.ts(2769)

Hi Phinna!
I had a similar issue with useMutation and found in my code that I forgot to return a result from axios request in the post method of APIClient class:


I am getting same error. I have re-confirmed regarding return statement at ‘apiClient.ts’. Would be pleased if anyone lends help to figure out this bug.