【发布时间】:2019-11-19 17:38:02
【问题描述】:
我想在需要时调用 useQuery,
但是useQuery不能在函数内部。
我的尝试代码是:
export const TestComponent = () => {
...
const { data, loading, error } = useQuery(gql(GET_USER_LIST), {
variables: {
data: {
page: changePage,
pageSize: 10,
},
},
})
...
...
const onSaveInformation = async () => {
try {
await updateInformation({...})
// I want to call useQuery once again.
} catch (e) {
return e
}
}
...
如何多次调用useQuery?
我可以随时调用吗?
我已经寻找了几个网站,但我找不到解决方案。
【问题讨论】:
标签: javascript reactjs graphql react-hooks react-apollo