更新时间:2022-11-30 10:27:31
You should have your data shape typed as in docs
const [loadUsers,{数据,错误}] = useLoadUsersLazyQuery();
const [loadUsers, { data, error }] = useLoadUsersLazyQuery();
如果生成器未定义任何 data
类型,则需要传递整个结果:
If no data
type defined by generator then you need to pass down entire result:
const queryResult = useLoadUsersLazyQuery();
const [loadUsers, { data, error }] = queryResult;
然后将其作为道具传递
{data!==null && data!==undefined && <UsersFoundList data={queryResult} />}
< UsersFoundList/>
中的
data
类型保持不变:
type UsersFoundListProps = {
data: LoadUsersQueryResult,
};
但您需要使用数据.
'前缀'或将其分解:
but you need to use data.
'prefix' or decompose it:
const {nodes, totalCount} = props.data.data; // instead of usual 'props.data'
节点
将是一个数组, totalCount
是一个数字
nodes
will be an array, totalCount
a number