<% @post.comments.each do |comment| %>
<%= react_component "Comment",
{ comment: comment.body } %>
<% end %>
comments.js.jsx
var Comments = React.createClass({
render() {
var createItem = ({body}) => ;
return
{this.props.comments.map(createItem)}
;
}
});
And render the component for each.
NOTE: When we render a component, from within a component, we can use this HTML-like syntax,