I'm trying to make a table which will have different coloured rows depending on an attribute which is derived from a map function:
var tableData = this.state.data.map(attribute =>
{if(attribute.duplicate.toString()== "true")
return <tr className="table-success">;
else
return <tr className="table-warning">;
}
<td> {count++} </td>
...
<td> {attribute.duplicate.toString()} </td>
</tr>
);
Now var tableData gets passed through to the actual table:
<div>
<div>
<table className="table">
<tr className="thead-inverse">
<th> # </th>
...
<th> duplicate </th>
</tr>
{tableData}
</table>
</div>
</div>
But I get the following error:
[INFO] Module build failed: SyntaxError: C:/Users/.../all.js: Unterminated JSX contents (78:14)
[INFO]
[INFO] 76 |
[INFO] 77 | </div>
[INFO] > 78 | </div>
[INFO] | ^
Any ideas what the problem is, or another way to achieve what I'm trying to do?