You need set this
for submit
method because now this
is undefined
, for this operation you can use .bind
onSubmit={ this.submit.bind(this) }
or you can use arrow function
onSubmit={ (e) => this.submit(e) }
You need set this
for submit
method because now this
is undefined
, for this operation you can use .bind
onSubmit={ this.submit.bind(this) }
or you can use arrow function
onSubmit={ (e) => this.submit(e) }