Last active
October 23, 2019 22:01
-
-
Save helielson/9a13609fa2c97d25e502e067b67a108f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RelayEnvironmentProvider from 'react-relay/lib/relay-experimental/RelayEnvironmentProvider'; | |
import useLazyLoadQuery from 'react-relay/lib/relay-experimental/useLazyLoadQuery'; | |
// ScreenA | |
function ScreenA() { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
return ( | |
<RelayEnvironmentProvider environment={environment}> | |
{renderSomeComponent(root)} | |
<RelayEnvironmentProvider> | |
); | |
} | |
// ScreenB | |
function ScreenB() { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
return ( | |
<RelayEnvironmentProvider environment={environment}> | |
{renderSomeComponent(root)} | |
<RelayEnvironmentProvider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment