The Relay "Environment"
The Relay "Environment"
The Relay "Environment" bundles together the configuration, cache storage, and network-handling that Relay needs in order to operate.
Most applications will create a single Environment instance and use it throughout. In specific situations, however, you may want to create multiple environments for different purposes. For example, you may create a new environment instance whenever the user logs in or out in order to prevent data for different users being cached together. Similarly, a server rendered application may create a new environment instance per request, so that each request gets its own cache and user data does not overlap. Alternatively, you might have multiple products or features within a larger application, and you want each one to have product-specific network-handling or caching.
A simple example
To create an environment instance in Relay Modern, use the RelayModernEnvir