-> 함수가 재사용될 수 있는것은 매개변수 덕분인것처럼!
-> 타입도 재사용되기 위해서 매개변수를 넣어서 제네릭하게 쓰는것과도 일맥상통.
// flex 로 가운데정렬
<div className="h-screen flex items-center justify-center">hello world</div>
// grid 로 가운데 정렬
<div className="h-screen grid place-items-center">hello world</div>;
cva("text-sm border rounded-full px-2.5 py-0.5") / cva(["text-sm", "border", "rounded-full", "px-2.5", "py-0.5"]);
- 타입 변경 전
interface ChipProps { label: string; intent?: "primary" | "secondary" | "danger" | "warning" | "info" | "default"; // intent 값이 선택이므로 안들어갈경우 undefined 여도 상관없다. -> defaultVariants 넣어놨으므로! }
- 타입 변경 후
type ChipVariantsType = VariantProps<typeof chipVariants>; type ChipProps = { label: string; } & ChipVariantsType;

ComponentProps<"button"> = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
type ButtonVariant = VariantProps<typeof buttonVariant>;
type ButtonProps = {} & ButtonVariant &
(
| ({} & ComponentProps<"button">)
| ({ href: string } & ComponentProps<typeof Link>)
);
function Button({
intent,
size,
variant,
children,
...props
}: PropsWithChildren<ButtonProps>) {
if ("href" in props) {
return (
<Link className={buttonVariant({ intent, size, variant })} {...props}>
{children}
</Link>
);
} else {
return (
<button className={buttonVariant({ intent, size, variant })} {...props}>
{children}
</button>
);
}
}
if ("href" in props)