[React Typescript] Generic function component
export const Table = <T>(props: TableProps<T>) => {
return (
<table>
<tbody>
{props.rows.map((row) => (
<tr>{props.renderRow(row)}</tr>
))}
</tbody>
</table>
);
};
Because ti's a tsx file, the way to fix it:
export const Table = <T,>(props: TableProps<T>) => {
or
export const Table = <T extends unknown>(props: TableProps<T>) => {