import React from 'react'; import _ from 'lodash'; interface Field { key: string; label: string; } interface Props { items?: any[]; fields: Field[]; handleRowClick?: (index: number) => void; } const ListTable: React.FC = ({ items = [], fields, handleRowClick = () => {} }) => { if (!items.length) return
No data
; return ( {fields.map(field => )} {items.map((item, index) => ( handleRowClick(index)} > {fields.map(field => )} ))}
{field.label}
{_.get(item, field.key)}
); }; export default ListTable;