Skip to content

Instantly share code, notes, and snippets.

@sogko
Last active October 14, 2015 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogko/6d7fa61e52014fb6c499 to your computer and use it in GitHub Desktop.
Save sogko/6d7fa61e52014fb6c499 to your computer and use it in GitHub Desktop.
hello-world-relay-part-1 - RelayJS App
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