2
我在我的React应用程序中尝试Relay,并且默认使用GraphQL。它看起来像这样(Score
一些React.js分量):有没有方法可以在没有GraphQL的情况下使用Relay?
Score = Relay.createContainer(Score, {
fragments: {
score:() => Relay.QL`
fragment on Score {
initials,
score,
}
`,
},
});
的问题是:我可以使用自定义的API函数将数据返回到片段?像这样:
Score = Relay.createContainer(Score, {
fragments: {
score: myCustomFunction(), // It will return a dataset.
},
});
谢谢你的回答!我认为复杂性和冗余灵活性太大,所以我选择了另一种方式:自己创建一个简单的React组件封装器。 –