this.questions = [{
"id" : 1 ,
"question" : "question",
"answers" : ["A","B","C","D"],
},
{
"id" : 2,
"question" : "question",
"answers" : ["A","B","C","D"],
}]
我有一個像這樣的對象。我將這些數據渲染到一張桌子上。用reactjs呈現對象內的數組元素
renderTable(result) {
return (
<table>
<tr><td>{result.id}</td><td>{result.question}</td></tr>
<tr><td>Answers</td>{result.answers}</td></tr>
</table>)
}
render() {
return (
<Row>
{this.questions.map(this.renderTable.bind(this))}
</Row>)
}
問:
我要呈現的答案陣列不同的表中的數據標籤的每一個元素。 我該怎麼做?
問候,