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