@samitouri / QOS-React-2 / commits / e527b3a464

Update handling-events.md (#8057)

Alireza Mostafizi committed Oct 23, 2016 at 05:44 UTC e527b3a464349434446f90f6ef55025c2d8669f0
1 file changed +1 -1
docs/docs/handling-events.md
+1 -1
@@ -91,7 +91,7 @@ ReactDOM.render(
91
92 [Try it on CodePen.](http://codepen.io/gaearon/pen/xEmzGg?editors=0010)
93
94 -You have to be careful about the meaning of `this` in JSX callbacks. In JavaScript, class methods are not [bound](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind) by default. If you forget to bind `this.toggle` and pass it to `onClick`, `this` will be `undefined` when the function is actually called.
94 +You have to be careful about the meaning of `this` in JSX callbacks. In JavaScript, class methods are not [bound](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind) by default. If you forget to bind `this.handleClick` and pass it to `onClick`, `this` will be `undefined` when the function is actually called.
95
96 This is not React-specific behavior; it is a part of [how functions work in JavaScript](https://www.smashingmagazine.com/2014/01/understanding-javascript-function-prototype-bind/). Generally, if you refer to a method without `()` after it, such as `onClick={this.handleClick}`, you should bind that method.
97