May 2019
Intermediate to advanced
496 pages
10h 38m
English
The core of Relay is the fetchQuery function. This function sends requests to your GraphQL endpoint. One of the parameters to the fetchQuery function is the environment, and we'll set this up in this section. This is an object of type Environment. We create it once and export it via a getEnvironment function, which our sagas will be able to call.
One of the arguments that the Environment object requires is a function that actually performs the fetch by calling window.fetch. We'll call this performFetch function and we'll start by building it first, and then move on to getEnvironment.
Read now
Unlock full access