I have a table and I want each row to be clickable and when you click on it to go to that link (which is different for each row).
<Table.Body>
{rows.map((row, rowIndex) => (
<Table.Row
key={idList && idList[rowIndex]}
onClick={() => {
<Link
to={
entityName && `/${entityName}/${idList[rows.indexOf(row)]}`
}
/>;
}}>
...
</Table.Row>
))}
</Table.Body>
So I did it like above, added a component but doesn't work. It says:
Expected an assignment or function call and instead saw an expression no-unused-expressions
I'm using Table
/ Table.Row
from Semantic UI
and Link
from react-router-dom
. I cannot change the Table
but the Link
component isn't mandatory. It would be great anyway if it can redirect to that link when it's clicked.
Is it any way to do this?