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>
);
}
}
- Typescript Component Generics React Classtypescript component generics react typescript component strongly react react typescript component strongly components typescript generics strongly component-level representation inter-class generation composable component context react typescript类型class typescript component function generic handlechange component function react component server react