Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created July 3, 2016 19:39
Show Gist options
  • Save chuck0523/5333a646471269266c18ea4080e272cd to your computer and use it in GitHub Desktop.
Save chuck0523/5333a646471269266c18ea4080e272cd to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import Relay from 'react-relay'
class JobDetail extends Component {
const jobId = ''
getCurrentJob(jobs) {
return jobs.filter(job => job.node.id === this.jobId)
}
render() {
return(
<div>
{this.getCurrentJob(this.props.aaa.jobs.edges)}
</div>
)
}
}
export default Relay.createContainer(JobDetail , {
fragments: {
aaa: () => Relay.QL`
fragment on Company {
name,
jobs(first: 6) {
edges {
node {
id,
name,
salary,
location,
details,
},
}
},
}
`
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment