Reputation: 673
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.
},
});
Upvotes: 5
Views: 2005
Reputation: 5457
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:
Upvotes: 6