[英]React Relay fetch list
I need to fetch list I have Schema 我需要获取列表我有架构
export const Schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
activities: {
name: 'Activities',
type: new GraphQLList(activityType),
resolve: (root, args, { rootValue }) => {
return User.findById(rootValue.req.user.id)
.populate('activities')
.then((user) => user.activities);
},
},
When I do graphql request using curl and sends 当我使用curl执行graphql请求并发送时
query ActivitiesQuery {
activities {
name
}
}
it gives me 它给了我
{
"data": {
"activities": [
{
"name": "Eat"
}
]
}
}
Can somebody give me example how can I fetch it using relay ? 有人可以举个例子,我怎么能用继电器取它? because all the examples give object and then list like Store: { teas: [... 因为所有的例子都给出了对象,然后像Store一样列出:{茶:[...
activities
is an example of a plural non-identifying field . activities
是复数非识别领域的一个例子。 It is plural in the sense that it returns a list of things, and non-identifying in the sense that the individual elements of that list are not identified by global IDs. 在它返回事物列表的意义上它是复数的,并且在该列表的各个元素未被全局ID识别的意义上是非识别的。
Relay does not support plural non-identifying fields at the root, but support is coming. Relay不支持根目录下的多个非标识字段,但支持即将到来。 Follow along at https://github.com/facebook/relay/issues/112 请访问https://github.com/facebook/relay/issues/112
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.