Skip to content

Instantly share code, notes, and snippets.

@bs1180
Last active April 17, 2016 18:51
Show Gist options
  • Save bs1180/bd68b017fcba2163b0c5ef2f23381c9a to your computer and use it in GitHub Desktop.
Save bs1180/bd68b017fcba2163b0c5ef2f23381c9a to your computer and use it in GitHub Desktop.
List Component
import React, { Component, PropTypes } from 'react'
import {dataConnect} from 'relate-js';
import { Link } from 'react-router'
const data = (
null,
null,
(props) => ({
fragments: {
viewer: {
claims: {
_id: true,
name: true,
status: true,
created_at: true
}
}
}
})
)
class ListClaims extends Component {
render () {
const { claims } = this.props.viewer
return (<div>
<table className="table">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{ claims.map((c, i) => {
<tr>
<td>{ c.name }</td>
<td><span className="tag">{ c.status }</span></td>
<td>{ c.created_at }</td>
</tr>}
}
</tbody>
</table>
</div>)
}
}
ListClaims.defaultProps = {
viewer: {
claims: []
}
}
export default dataConnect(data)(ListClaims)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment