I have a LoginForm component. I want to check before submit, that both loginName and password is set. I tried with this code (a lot of stuff omitte
loginName
password
You need set this for submit method because now this is undefined, for this operation you can use .bind
this
submit
undefined
.bind
onSubmit={ this.submit.bind(this) }
Example
or you can use arrow function
onSubmit={ (e) => this.submit(e) }