react.componenttype typescript code example
Example 1: ts react props type
type Props = {
size: string;
}
const Component = ({ size = 'medium' }: Props) => (
<div className={cn('spinner', size)} />
);
Example 2: type a passed component typescript react
interface ParentCompProps {
childComp?: React.ReactNode;
}