Skip to content

Instantly share code, notes, and snippets.

@mt9304
Last active October 17, 2018 05:06
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 mt9304/fe72fac20278203c3ece7263536a741e to your computer and use it in GitHub Desktop.
Save mt9304/fe72fac20278203c3ece7263536a741e to your computer and use it in GitHub Desktop.
class BookTable extends React.Component {
constructor(props) {
super(props);
this.state = props;
}
renderItems() {
return this.state.books.map((book) => (
<Book key={book.id} book={book} />
));
}
render() {
return (
<table className='table table-striped'>
<thead>
<tr>
<th className='col-md-3'>Title</th>
<th className='col-md-2'>Author</th>
<th className='col-md-3'>Description</th>
<th className='col-md-4'>Pages</th>
<th className='col-md-5'>Published</th>
<th className='col-md-6'>Actions</th>
</tr>
</thead>
<tbody>{this.renderItems()}</tbody>
</table>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment