Error: Uncaught TypeError: Cannot read property 'manageChange' of undefined
I have bound the method to "this" as well. I have even tried the arrow function format to define "manageChange". It still does not work.
Please help out with identifying the issue? Code:
class App extends React.Component {
constructor() {
super();
this.state = { todos: TodoData };
this.manageChange = this.manageChange.bind(this);
}
manageChange(id) {
console.log(id);
}
render() {
const todoItems = this.state.todos.map(function (item) {
return (<TodoItem key={item.id} items={item}
handleChange={this.manageChange} />);
}
);
return
(
<div className="app">
{todoItems}
</div>
);
}
}