组件与 Props

公开免费 · 适合入门

组件与 Props

函数组件 + TypeScript 接口定义 Props 是推荐写法。

interface ButtonProps {
  label: string;
  onClick?: () => void;
}