interface TableProps<T> {
rows: T[];
renderRow: (row: T) => ReactNode;
}
export class Table<T> extends React.Component<TableProps<T>> {
render(): ReactNode {
return (
<table>
<tbody>
{this.props.rows.map((row) => (
<tr>{this.props.renderRow(row)}</tr>
))}
</tbody>
</table>
);
}
}
标签:rows,Component,React,Typescript,props,row From: https://www.cnblogs.com/Answer1215/p/17624961.html