Version: Next ๐Ÿšง



Hook used to access a Relay environment that was set by a RelayEnvironmentProvider:

const React = require('React');
const {useRelayEnvironment} = require('react-relay');
function MyComponent() {
const environment = useRelayEnvironment();
const handler = useCallback(() => {
// For example, can be used to pass the environment to functions
// that require a Relay environment.
commitMutation(environment, ...);
}, [environment])
return (...);
module.exports = MyComponent;

Is this page useful?
Last updated on by Tianyu Yao