import React from "react";
import ReactDOM from "react-dom";

// 组件的属性

type Props = { name: string; age?: number }
class Hello extends React.Component<Props> {
  // 在类组件中给 age 添加默认属性
  static defaultProps: Partial<Props> = {
    age: 20
  }

  render() {
    const { name, age } = this.props
    return (
      <div>我是：{name}, 我 { age } 岁</div>
    )
  }
}



const App = () => <div>
  <Hello name="Ken"/>
</div>

ReactDOM.render(<App />, document.getElementById('root'))