Assume I have a field called country
defined at the top level of my GraphQL schema. I can query it in the following way:
query {
country(alpha2: "gb") {
name
}
}
In my relay container I can specify the attributes that I would like returned with a fragment on Country
:
export default Relay.createContainer(CountryComponent, {
fragments: {
country: () => Relay.QL`
fragment on Country {
name
}
`
}
}
How can I change the value of the alpha2
argument from within my react component? I could nest the country
field under some arbitrary field and declare my relay fragment on the parent but would rather avoid unnecessarily modifying my graph if possible.
react-router-relay
– Peter Horne