【发布时间】:2021-05-10 10:09:22
【问题描述】:
早上好,我收到一个语法错误,我不知道状态部分的问题是什么
constructor(props) {
super(props);
this.onChangeName = this.onChangeName.bind(this);
this.onChangeEmail = this.onChangeEmail.bind(this);
this.onChangePassword = this.onChangePassword.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.state = {
name = '',
email = '',
password = ''
}
}
<form onSubmit={ this.onSubmit } >
<input type='name' placeholder='Nombre' value={ this.state.name } onChange={ this.onChangeName } required />
<input type='email' placeholder='Email' value={ this.state.email } onChange={ this.onChangeEmail } required />
<input type='password' placeholder='Contraseña' value={ this.state.password } onChange={ this.onChangePassword } required />
【问题讨论】:
-
使用半列而不是相等(例如名称:“fanjiloo”)
标签: javascript reactjs