I'm trying Relay in my React application, and it uses GraphQL by default. It looks like this ( Score
is some React.js component):
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? 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 .
In the meantime, you have two options:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.