I am doing React + Rails application, for JSON I use default jbuilder. But as react-rails official documentation suggests I add a root node to the JSON like that:
{
  "comments":
      [
        {"id":1,"author_name":null,"comment_text":null,"url":"http://localhost:3000/comments/1.json"}
      ]
}
in my Javascript file I want to do something like this:
var commentNodes = this.props.comments.map(function(comment,index){
   return (
     <Comment author_name={comment.author_name} comment_text={comment.comment_text} key={index} />
    );
});
but since now I have root node, I can not use this.props.comment.map I get an error:
Uncaught TypeError: this.props.comments.map is not a function
EDIT: I add comments to component as follows:
<CommentList comments={this.state.comments}/>
 
     
    