Last active
August 31, 2017 14:48
-
-
Save ronal2do/ec0d6dbabc1692d3d7a6214d54ccc9cc 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
// Esse código completo você pode encontrar no repositório | |
// https://github.com/ronal2do/RNRelayModern/blob/master/src/App.js | |
import { QueryRenderer, graphql } from 'react-relay'; | |
import environment from '../createRelayEnvironment'; | |
// importamos o environment | |
==== | |
// aqui criamos uma abstração da query | |
const query = graphql` | |
query AppQuery { | |
users { | |
edges { | |
node { | |
name | |
} | |
} | |
} | |
} | |
`; | |
==== | |
<QueryRenderer | |
environment={environment} | |
query={query} // aqui importamos a query | |
render={({ error, props }) => { | |
if (error) { | |
return <Text>{error.message}</Text>; | |
} else if (props) { | |
console.log('===================================='); | |
console.log('props', props); | |
console.log('===================================='); | |
} | |
return <Text>Loading...</Text>; | |
}} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment