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.
cacheConfig?: Optional object containing a set of cache configuration options, i.e.
force: truerequires the fetch to be issued regardless of the state of any configured response cache. See the types for more
The function returns a
Promise that resolves with an object containing data obtained from the query.