反应查询回调函数没有接收 queryKey 数组作为参数

react-query callback function isn't receiving queryKey array as params

const fetchData = async (key, compId, tmId) => {
    console.log('params: ', { key, compId, tmId });

    let url = `/this-path/comp/${compId}/tm/${tmId}`;
    const result = await axios.get(url);
    return result.data;
};

const fetchOutput = useQuery(['string-key', 231, 1053039], fetchData);

在上面的例子中,我们需要 fetchData() 参数 compId 等于 231,tmId 等于 1053039。根据我对 react-query 的理解,我认为我会得到这个。然而,我们得到的是:

...其中 queryKey 数组可在 key.queryKey 处访问,但是参数 compIdtmId 未定义,即使我们这样使用 useQuery(): useQuery(['string-key', 231, 1053039], fetchData)...

我们是否遗漏了什么?我们怎样才能得到这些值作为回调fetchData函数的参数?

这来自 v3 迁移指南,回答了我的问题...