我想執行disNone()
內saveInfo()
單擊時按鈕: 錯誤:類型錯誤:未定義要執行disNone()函數內saveInfo()函數被點擊按鈕
import React, { Component } from 'react';
class Login extends Component {
constructor(props){
super(props);
this.state = {
dispNone:"dispNone",
message:"dispNone"
};
this.disNone = this.disNone.bind(this);
};
disNone(){
this.setState({
dispNone: "dispNone",
message:"dispBlock"
});
}
saveInfo(){
this.disNone();
}
render() {
return (
<div>
// other code
<button onClick={this.saveInfo}>Sign up</button>
</div>
);
}
}
export default Login;
無法讀取屬性「disNone」
什麼是錯誤? –
TypeError:無法讀取未定義的屬性'disNone' –