summaryrefslogtreecommitdiff
path: root/src/components/ListTable.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ListTable.tsx')
-rw-r--r--src/components/ListTable.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/ListTable.tsx b/src/components/ListTable.tsx
index 85b86aa..5c1333a 100644
--- a/src/components/ListTable.tsx
+++ b/src/components/ListTable.tsx
@@ -18,16 +18,17 @@ const ListTable: React.FC<Props> = ({ items = [], fields, handleRowClick = () =>
<table className="table-auto w-full">
<thead>
<tr className="border-b select-none">
- {fields.map(field => <th>{field.label}</th>)}
+ {fields.map(field => <th key={field.label}>{field.label}</th>)}
</tr>
</thead>
<tbody>
{items.map((item, index) => (
<tr
+ key={item._id}
className={`border-b hover:bg-gray-100 cursor-pointer ${index % 2 && 'bg-gray-50'}`}
onClick={() => handleRowClick(index)}
>
- {fields.map(field => <td className="p-3">{item[field.key]}</td>)}
+ {fields.map(field => <td key={`${item._id} ${field.label}`} className="p-3">{item[field.key]}</td>)}
</tr>
))}
</tbody>