Skip to content

Instantly share code, notes, and snippets.

@styks1987
Created January 25, 2016 20:21
Show Gist options
  • Save styks1987/cc03d43b56a2a569cde7 to your computer and use it in GitHub Desktop.
Save styks1987/cc03d43b56a2a569cde7 to your computer and use it in GitHub Desktop.
var React = require('react');
var Store = require('./store');
var Comment = require('./comment');
module.exports = React.createClass({
render: function () {
console.log(Comment);
return (
<div>
{this.props.comments.map((comment, i) => {
//var commentProps = this._setComment(comment, i);
return <Comment key={i + '_comment'} {...comment} />
})}
</div>
);
}
});
// In another file
var React = require('react');
var Moment = require('moment')
var Comments = require('./comments');
module.exports = React.createClass({
render: function () {
console.log(Comments);
return (
<div className="message">
<p>{this.props.id}</p>
<p>{this.props.text}</p>
<p className="caption">
{this.props.user.full_name} {Moment(this.props.created).format('M/D/YY, h:mm a')}
</p>
<Comments comments={this.props.child_comments} />
<div className="clearfix"></div>
</div>
)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment