I'm trying to change column widths based on the ids received from the map function. Here is the code:
<TableRow>
{
tableData.header.map(header => {
header.id === "name" ?
(<TableCell style={{width: 100}} align="center" key={header.id}>
{
header.title
}
</TableCell>)
:
(<TableCell style={{minWidth: 185}} align="center" key={header.id}>
{
header.title
}
</TableCell>)
})
}
</TableRow>
But I'm getting an error on this line:
header.id === "name" ?
The error being shown is: "Expected an assignment or function call and instead saw an expression no-unused-expressions"
Where am I going wrong?
I've tried adding return before TableCell in both cases bit it gives an error.