I am trying to create a shared table component. And, on this table I am trying to make those edit url dynamic. Code is straight forward and loos like:
const actionColumn = (
<Link
to={`/suppliers/ROW_ID/edit`}
className="btn btn-info btn-xs"
title="Edit"
>
<i className="fas fa-pencil-alt"></i>
</Link>
);
<Table
actionColumn={actionColumn}
/>
Now on the table, I want to replace ROW_ID
with the row.id
{list &&
list.map((row, i) => (
<tr>
<td>
{actionColumn.replace(
"ROW_ID",
row.id
)}
</td>
</tr>
))}
I tried to use .replace
but received an error: actionColumn.replace is not a function