1
私は間違って何をしているのですか?TypeError:nullのプロパティ 'count'を読み取ることができません。初期状態を正しく設定していないのですか?初期状態に反応します。
import React from 'react';
class User extends React.Component {
\t super(props){
\t \t this.state = {
\t \t \t count: 0
\t \t }
\t }
\t increment(){
\t \t this.setState({ count: this.state.count + 1 })
\t }
\t render(){
\t \t return(<div>
\t \t \t <button
\t \t \t \t onClick={this.increment}>
\t \t \t \t \t \t {this.state.count}
\t \t \t </button>
\t \t </div>)
\t }
}
export default User;
おかげのように、男を矢印機能を使用することができます –