【发布时间】:2018-01-02 07:59:47
【问题描述】:
<div className="feedback">
{(this.state.finished) ? questions.map(function(x, index) { return
<div>
</div>
}) : null}
</div>
所以我现在有上面的代码。我想添加另一段类似 this.state.score 的 js 代码,但不在 map 函数中,因为我只希望它渲染一次(目前它每次映射到数组时都会渲染)
<div className="feedback">
{(this.state.finished) ? {this.state.score} //WANT TO ADD IT HERE questions.map(function(x, index) { return
<div>
</div>
}) : null}
</div>
但这不起作用。那么如何在此块中添加我的代码?我也需要它在三元中
【问题讨论】: