Skip to content

Props-Type-in-React-Component

수정하기
문서 생성 2023-06-04 12:32:01 최근 수정 2023-06-04 12:32:01

TypeScript로 component props type 설정

type CardProps = {
style: React.CSSProperties
children: React.ReactNode
}
const Card: React.FC<CardProps> = ({ style, children }) => {
return (
<div className="card" style={style}>
{children}
</div>
)
}

LINKS TO THIS PAGE

Tags