Actually, I\'ve been trying to add a \'Delete a comment\' functionality to my Comment Box system.
Here is my code:-
var Comment = React.createClass(
The function passed to map
will not automatically share a this
pointer with your react class.
To use this
inside the anonymous function, call .bind(this)
at the end of the function definition to yield a function with the expected this
inside.
var commentNodes = this.props.comments.map(function (comment, index) {
...
});
Becomes:
var commentNodes = this.props.comments.map(function (comment, index) {
...
}.bind(this));