在我将react查询更新到最新版本后,在使用useMutation时,“isLoading”状态未定义。这是代码:
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 };
};
这是类型错误
Property 'isLoading' does not exist on type 'UseMutationResult<any, Error, CreateNoteData, unknown>'.
当我控制台记录“isLoading”时,它是未定义的