columns = ['red','green','blue']
d = {f'x{i}': c for i,c in enumerate(columns,1)}
我正在使用上面的代码通过react-apollo发送graphQL查询。正如您在上面看到的,我在选项中放置了一个道具,以指定在发送查询时要使用哪个客户端。运行代码时,出现错误,提示export default graphql(queryShippingRates,{
options: props => ({
variables: {
id: props.navigation.state.params.checkout.id
},pollInterval: 5000,client: {
apolloclient: props.navigation.state.params.apolloclient
}
}),props: ({
data
}) => {
if (data.loading) {
return {
fetchNextPage: () => {}
};
} else if (!data.node.availableShippingRates.ready) {
return {
fetchNextPage: () => {}
};
} else if (!data) {
return {
fetchNextPage: () => {}
};
} else if (data.error) {
console.warn('error',data.error);
}
const fetchNextPage = () => {
return data.fetchMore({
updateQuery: (previousResult,{
fetchMoreResult
}) => {
return {
node: fetchMoreResult.data.node,};
},});
};
console.log(fetchNextPage);
return {
data: data,};
},})(CheckoutShippingMethodScreen);
不是函数。
我的应用程序由具有指定客户端的ApolloProvider组件包装,但我读到您可以将自定义客户端作为道具。有人可以帮我吗?