After I updated react query to the latest version, I am getting undefined for 'isLoading' state when using useMutation. Here is the code:
const useAddUserNote = (owner: string) => {
const queryClient = useQueryClient();
const { mutate, error, data, isLoading } = useMutation({
mutationFn: (note: CreateNoteData) => addUserNote(note),
onSuccess: () => {
queryClient.invalidateQueries(["allUserNotes", owner]);
},
});
if (error instanceof Error) error;
return { mutate, data, error, isLoading };
};
Here is the type error
Property 'isLoading' does not exist on type 'UseMutationResult<any, Error, CreateNoteData, unknown>'.
When I console log the 'isLoading', it is undefined