I would like to create pluggable React components. Components are resolved by their class names, so I am naturally drawn to generics; but this doesn\'t seem to work.
<
The accepted answer for this question still stands, due to TypeScript types being erased, however as of Typescript 2.9, generic JSX components are supported
The example provided is:
class GenericComponent extends React.Component
{
internalProp: P;
}
type Props = { a: number; b: string; };
const x = a={10} b="hi"/>; // OK
const y = a={10} b={20} />; // Error
Just thought it worth mentioning for anyone who ends up here via the question title.