我试图显示来自嵌套graphql查询的数据,并继续收到400状态代码错误。
我要撤回的是LocGroups.name
预先感谢
import React, { Component } from "react";
import { Query } from "react-apollo";
import gql from "graphql-tag";
const LOCATION_QUERY = gql`
query LOCATION_QUERY {
user {
userEnterprises {
userEnterpriseInfo {
LocGroups {
name
locGroupId
}
}
}
}
}
`;
class LocationsSelector extends Component {
render() {
return (
<div>
<Query query={LOCATION_QUERY}>
{({ data, error, loading }) => {
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return (
<div>
{data.user.userEnterprises.userEnterpriseInfo.LocGroups.name}
</div>
);
}}
</Query>
</div>
);
}
}
export default LocationsSelector;