Typescript Specifying Prop type code example
Example: ts react props type
type Props = {
size: string;
}
const Component = ({ size = 'medium' }: Props) => (
<div className={cn('spinner', size)} />
);
type Props = {
size: string;
}
const Component = ({ size = 'medium' }: Props) => (
<div className={cn('spinner', size)} />
);