Version: v11.0.0



This component is used to set a Relay environment in React Context. Usually, a single instance of this component should be rendered at the very root of the application, in order to set the Relay environment for the whole application:

const React = require('React');
const {RelayEnvironmentProvider} = require('react-relay');
const Environment = createNewEnvironment();
function Root() {
return (
<RelayEnvironmentProvider environment={Environment}>
<App />
module.exports = Root;


  • environment: The Relay environment to set in React Context. Any Relay Hooks (like useLazyLoadQuery or useFragment) used in descendants of this provider component will use the Relay environment specified here

Is this page useful?
Last updated on by Andrey Lunyov