📜  反应打字稿代码示例中的状态

📅  最后修改于: 2022-03-11 14:48:28.351000             🧑  作者: Mango

代码示例1
interface IProps {
}

interface IState {
  playOrPause?: string;
}

class Player extends React.Component {
  // ------------------------------------------^
  constructor(props: IProps) {
    super(props);

    this.state = {
      playOrPause: 'Play'
    };
  }

  render() {
    return(
      
); } }