中断请求
通过 useHook 接收abort
用于手动中断请求。
// useRequest
const {
// ...
// abort函数用于中断请求
abort
} = useRequest(todoListGetter);
// useWatcher
const {
// ...
// abort函数用于中断请求
abort
} = useWatcher(todoListGetter, [page]);
然后再调用abort
方法即可中断请求。
const handleCancel = () => {
abort();
};