useIsFetching 是一个可选钩子,返回当前应用在后台加载或获取中的查询 数量(适用于全局加载指示器)。
import { useIsFetching } from '@tanstack/solid-query'
// 有多少查询正在获取中?
const isFetching = useIsFetching()
// 匹配 posts 前缀的查询有多少正在获取中?
const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })
import { useIsFetching } from '@tanstack/solid-query'
// 有多少查询正在获取中?
const isFetching = useIsFetching()
// 匹配 posts 前缀的查询有多少正在获取中?
const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })
选项
返回值