You can use the
fetchQuery function to imperatively make GraphQL Requests. This is useful for cases where you want to make requests outside of React but still utilize the Relay store and network layer.
environment: The Relay Environment
graphqltagged query. Note:
relay-compilerenforces the query to be named as
variables: Object containing set of variables to pass to the GraphQL query, i.e. a mapping from variable name to value.
The function returns a
Promise that resolves with an object containing data obtained from the query.