From ff732efdcdbb1f4e8d4e7dc289aff070dd53283f Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Fri, 21 May 2021 09:10:33 +0100 Subject: [PATCH] [Table][s]: Add id to table rows --- src/components/views/Table.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/views/Table.js b/src/components/views/Table.js index b426473b..32965b07 100644 --- a/src/components/views/Table.js +++ b/src/components/views/Table.js @@ -8,9 +8,14 @@ import PropTypes from 'prop-types'; * @param data: an array of data objects e.g. [ {col1: 1, col2: 2}, {col1: 5, col2: 7} ] */ const Table = ({ columns, data }) => { + let rows = [...data,] + rows = rows.map((row, i) => { + row['id'] = i + return row + }) return (
- +
); }