Javascript 反应嵌入循环

Javascript 反应嵌入循环,javascript,reactjs,Javascript,Reactjs,我有一个包含少量元素的对象列表,单个元素如下所示: { 'id': '5d4647dsa54d6s4ad65as', 'date': '2016-06-09T15:03:12.000Z', 'title': 'Istvan 5', 'text': 'Pathos, betrayal, "The Galaxy will be Burning!", ', 'coments': [ { 'id': 'qwerty',

我有一个包含少量元素的对象列表,单个元素如下所示:

{
    'id': '5d4647dsa54d6s4ad65as',
    'date': '2016-06-09T15:03:12.000Z',
    'title': 'Istvan 5',
    'text': 'Pathos, betrayal, "The Galaxy will be Burning!", ',
    'coments': [
        {
            'id': 'qwerty',
            'user': 'Gu1iman',
            'text': 'The Code of Adeptus Astartes does not approve of     this'
        },
        {
            'id': 'asdfg',
            'user': 'Feru5 Manu5',
            'text': 'I lost my had for love!'
        },
        {
            'id': 'zxcvb',
            'user': 'Fu1grim Fenix',
            'text': 'I know bro, I know'
        },
    ]
},
我可以显示文本:

export default class ArticleList extends PureComponent
  {
   state = {
       openArticleId: null
   }
   render(){
       const articleElements = this.props.articles.map((articles,    index)     =>
           <li key={articles.id} className='article-list__li' onClick=              
  {this.handelClick.bind(this, articles.id)}>
               <Article article = {articles}
                        isOpen = {this.state.openArticleId ===    articles.id}
                        onButtonClick = {this.handelClick.bind(this, articles.id)}/>
           </li>
       )
       return (
           <ul>
               {articleElements}
           </ul>
       )
   }
   handelClick = openArticleId => this.setState({
       openArticleId: this.state.openArticleId === openArticleId ?    null : openArticleId
   })
}
导出默认类ArticleList扩展PureComponent
{
状态={
openArticleId:null
}
render(){
constArticleElements=this.props.articles.map((文章,索引)=>
  • ) 返回(
      {articleElements}
    ) } handelClick=openArticleId=>this.setState({ openArticleId:this.state.openArticleId==openArticleId?null:openArticleId }) }
    但我不介意如何显示此文本的“注释”。我如何显示这个?我曾尝试编写嵌入式循环,但它没有正常工作

    
    
    this.props.article.comments.map(
    
    (!!this.props.isOpen && this.props.article.comments.map(