应用程序错误!错误的参数类型。从v5开始,调用查询相关函数时只允许“Object”形式。请使用错误堆栈查找罪魁祸首调用。更多信息请访问:https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object
从“@tanstack/react-query”导入{ useQuery };
const AllUsers =()=> {
const {data: users = [], refetch} = useQuery(['users'], async() => {
const res = await fetch('http://localhost:5000/users')
return res.json();
})
return (
<div>
{users.length}
</div>
);
字符串
};
导出默认值AllUsers;
2条答案
按热度按时间qvtsj1bj1#
尝试以对象格式发送参数。示例:
字符串
cgvd09ve2#
字符串