Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created July 1, 2016 13:58
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 chuck0523/f9b1e937394abe79f7b3b479b7804e6b to your computer and use it in GitHub Desktop.
Save chuck0523/f9b1e937394abe79f7b3b479b7804e6b to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import Relay from 'react-relay'
class Hello extends Component {
render() {
return(
<div>
<h2>My jobs!</h2>
<ul>
{this.props.chuck.jobs.edges.map(job =>
<li key={job.node.id}>{job.node.name} (salary: {job.node.salary})</li>
)}
</ul>
</div>
)
}
}
export default Relay.createContainer(Hello, {
fragments: {
chuck: () => Relay.QL`
fragment on User {
name,
jobs(first: 3) {
edges {
node {
id,
name,
salary
},
}
},
}
`
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment