Last active
October 14, 2015 14:53
-
-
Save sogko/6d7fa61e52014fb6c499 to your computer and use it in GitHub Desktop.
hello-world-relay-part-1 - RelayJS App
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 React from 'react'; | |
import Relay from 'react-relay'; | |
// Your React component | |
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<h1>{this.props.latestPost.text}</h1> | |
</div> | |
); | |
} | |
} | |
// Your Relay container. | |
// Compose your React components with a declaration of | |
// the GraphQL query fragments that fetch their data. | |
export default Relay.createContainer(App, { | |
fragments: { | |
latestPost: () => Relay.QL` | |
fragment on Post { | |
text | |
} | |
`, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment