useFetch
签名
function useFetch<T, U>(
url: string,
options?: RequestInit & {
parseResponse?: (response: Response) => Promise<T>;
initialData?: U;
keepPreviousData?: boolean;
execute?: boolean;
onError?: (error: Error) => void;
onData?: (data: T) => void;
onWillExecute?: (args: [string, RequestInit]) -> void;
}
): AsyncState<T> & {
revalidate: () => void;
mutate: MutatePromise<T | U | undefined>;
};参数
返回
例子
依赖于列表搜索文本的参数
变更和优化更新
类型
AsyncState
MutatePromise
最后更新于