React Error cannot read property 'onChange' of undefined The app class is calling for a map of Breakpoint components
<Breakpoints key={breakpoint.key}
name={breakpoint.name}
minWidth={breakpoint.minWidth}
onChange={function () { // this is where react says my error is
this.onChange(breakpoint)
}.bind(this)}/>
this is the parent method
`onChange(breakpoint) {
this.props.breakpoints[breakpoint.key].name = name;
this.state (this.state);
console.log(breakpoint)
}`
these are the child elements
<input type="text" name="name" defaultValue={this.state.name} onBlur={this.onChange}/>
<input type="text" name="minWidth" defaultValue={this.state.minWidth} onBlur={this.onChange}/>
this is how I am watching and trying to update the code
onChange(e) {
e.preventDefault();
this.setState(
{[e.target.name]: e.target.value},
function () {
console.log(this.state.name);
this.props.onChange({
key: this.state.key,
name: this.state.name,
minWidth: this.state.minWidth
});
}
);
}