in the following code snippet,
type T1 = React.Component;
type T2 = typeof React.Component;
what"s the difference between T1 and T2?
< hr >go one step further and give the following definition:
class CardHeader extends React.Component {...}
and a function: defined elsewhere to render it
- Function definition-sharp1
function renderCardHeader(Comp: React.Component) {
return <Comp />;
}
- Function definition-sharp2
function renderCardHeader(Comp: typeof React.Component) {
return <Comp />;
}
Function definition-sharp1 will report an error in < Comp / >
in TS 2.9.2:
JSX element type "Comp" does not have any construct or call signatures.
Why is this? Isn"t React.Component
a type?
also, in the Function definition-sharp2, Comp: typeof React.Component
, what is the type of a type?