Skip to content

Instantly share code, notes, and snippets.

@ColeTownsend
Last active Apr 1, 2017
Embed
What would you like to do?
The Post component
import React, { PropTypes } from 'react';
import moment from 'moment';
export default class Post extends React.Component {
constructor (props) {
super(props);
}
render () {
const {
id,
description,
name,
thumbnails,
link,
created_at,
} = this.props.post;
const collectionId = this.props.post.collection_id;
return (
<div
key={id}
>
<div>
<img alt={name} src={thumbnails.large} />
</div>
<div>
<div>
{link
? <a href={link}>
<h3>{name}</h3>
</a>
: <h3>{name}</h3>
}
</div>
<h5>Added {moment(created_at).fromNow()}</h5>
{description &&
<div>
<p>{description}</p>
</div>
}
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment