FirmCiti Inc
FirmCiti Inc

Reputation: 407

Input field is not accepting characters

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

Answers (1)

I&#39;m Limit
I&#39;m Limit

Reputation: 899

Change onClick={this.handleChange} to onChange={this.handleChange}

Because this.handleChange was triggered when you click only

Upvotes: 3

Related Questions