我有array
的Objects
,我将数据添加到HTML Table
。现在我需要按版本对数据进行排序。我如何在React
中做类似的事情?如何在ReactJS中对HTML表格进行排序
render() {
return (
<div>
<div>
<Label> We got {this.state.count} elements in our database. </Label>
</div>
<div>
<Table hover striped bordered responsive size="sm" >
<thead>
<tr>
<th>VERSION</th>
<th>DATE</th>
<th>UUID</th>
</tr>
</thead>
<tbody>
{this.state.results.map(result =>
<tr key={result.fileId}>
<td>{result.VERSION}</td>
<td>{result.ORIGIN}</td>
<td>{result.UUID}</td>
</tr>
)}
</tbody>
</Table>
</div>
</div>
);
}
}
也许我可以使用一些js
脚本,但告诉我如何使用它,我是新与ReactJS
。例如,我的版本是0.26.8
。
我的版本是这样的:'0.22.6',不仅是一个数字。我忘了将它添加到描述中。已更新,对不起。 –
@AleksanderSołop查看我的编辑 – Timo