1interface IProps {
2}
3
4interface IState {
5 playOrPause?: string;
6}
7
8class Player extends React.Component<IProps, IState> {
9 // ------------------------------------------^
10 constructor(props: IProps) {
11 super(props);
12
13 this.state = {
14 playOrPause: 'Play'
15 };
16 }
17
18 render() {
19 return(
20 <div>
21 <button
22 ref={playPause => this.playPause = playPause}
23 title={this.state.playOrPause} // in this line I get an error
24 >
25 Play
26 </button>
27 </div>
28 );
29 }
30}
1interface IProps {
2}
3
4interface IState {
5 playOrPause?: string;
6}
7
8class Player extends React.Component<IProps, IState> {
9 // ------------------------------------------^
10 constructor(props: IProps) {
11 super(props);
12
13 this.state = {
14 playOrPause: 'Play'
15 };
16 }
17
18 render() {
19 return(
20 <div>
21 <button
22 ref={playPause => this.playPause = playPause}
23 title={this.state.playOrPause} // in this line I get an error
24 >
25 Play
26 </button>
27 </div>
28 );
29 }
30}
31