简体中文
Appearance
异步请求 Hook,管理加载状态、错误和数据。
import { useRequestFn } from '@vaclock/utils'; const [state, fetchUser] = useRequestFn(async (id) => { const res = await fetch(`/api/user/${id}`); return res.json(); }); // state.loading // state.value // state.error