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