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>) => {
- Typescript component function Generic Reacttypescript component function generic typescript component strongly react typescript component generics react react typescript component strongly handlechange component function react react typescript components propstype react typescript function overload typescript generic reduce write typescript cleanup generic wrapper typescript built-in possible generic