Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created Jul 1, 2016
Embed
What would you like to do?
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