[英]Is there way to use Relay without GraphQL?
I'm trying Relay in my React application, and it uses GraphQL by default. 我正在我的React应用程序中尝试Relay,它默认使用GraphQL。 It looks like this (
Score
is some React.js component): 看起来像这样(
Score
是一些React.js组件):
Score = Relay.createContainer(Score, {
fragments: {
score: () => Relay.QL`
fragment on Score {
initials,
score,
}
`,
},
});
The question is: can I use custom API functions to return data into fragments? 问题是:我可以使用自定义API函数将数据返回为片段吗? Like this:
像这样:
Score = Relay.createContainer(Score, {
fragments: {
score: myCustomFunction(), // It will return a dataset.
},
});
No, not yet. 还没有。 Support for augmenting the server schema with "local" data is being discussed in this GitHub issue .
在GitHub问题中讨论了使用“本地”数据扩展服务器架构的支持。
In the meantime, you have two options: 同时,您有两个选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.