类组件
- 定义类组件
interface State {}interface Props {}class 类组件名 extends React.Component<Props, State> {render(){return <div></div>}}
函数组件
- 函数组件定义
interface Props {}interface State {}const 函数组件名 = (props: Props) => {return <div></div>}
函数组件定义状态
- const [ 状态 , set状态] = useState<状态类型>( 数据 )
