cannot read property of undefined state variables react code example
Example: Cannot read property 'setState' of undefined
// way #1 - recommended
// puting .bind(this) after using the reference
<input onChange={this.onInputChange.bind(this)} placeholder="First Name" />
// way #2
// adding this line for each method you use
constructor(){
this.onInputChange = this.onInputChange.bind(this)
}