Reputation: 407
Trying to authenticate a user login, but whenever "value="{}" is entered, it doesn't displays any value inside the field area.
class Login extends Component{
constructor(props){
super(props)
this.state = {
email:"",
password:"",
fireErrors:"",
formTitle: "Login",
loginBtn: true
}
}
handleChange = e =>{
this.setState({[e.target.name]: e.target.value})
}
....
<input type="text" onClick={this.handleChange} value={this.state.email} name="email"/>
Upvotes: 0
Views: 51
Reputation: 899
Change onClick={this.handleChange}
to onChange={this.handleChange}
Because this.handleChange
was triggered when you click only
Upvotes: 3