我是这个 反应查询反应查询库的新手。
我知道当我想要获取数据时,我可以用这个库来做类似的事情:
const fetchData = async()=>{...}
// it starts fetching data from backend with this line of code
const {status, data, error} = useQuery(myKey, fetchData());
有用。但是如何只在单击按钮时触发数据获取呢?,我知道我可能会做一些像 <Button onPress={() => {useQuery(myKey, fetchData())}}/>
,但如何管理返回的数据和状态..。