let data = [
{ id: 1, author: "Pete Hunt", text: "This is one comment" },
{ id: 2, author: "Jordan Walke", text: "This is *another* comment" }
];
let Comment = React.createClass({
rawMarkup: function () {
let rawMarkup = marked(this.props.children.toString(), { sanitize: true });
return { __html: rawMarkup };
},
render: function () {
return (
{this.props.author}
);
}
});
let CommentList = React.createClass({
render: function () {
let commentNodes = this.props.data.map(function (comment) {
return (
{comment.text}
);
});
return (
{commentNodes}
);
}
});
let CommentForm = React.createClass({
render: function () {
return (
Hello, world! I am a CommentForm.
);
}
});
let CommentBox = React.createClass({
render: function () {
return (
Comments
);
}
});
ReactDOM.render(
,
document.getElementById("content")
);