File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ ReactDOM.render(
91
91
);
92
92
```
93
93
94
- [ ** 在 CodePen 上尝试** ] ( http ://codepen.io/gaearon/pen/xEmzGg?editors=0010)
94
+ [ ** 在 CodePen 上尝试** ] ( https ://codepen.io/gaearon/pen/xEmzGg?editors=0010)
95
95
96
96
你必须谨慎对待 JSX 回调函数中的 ` this ` ,在 JavaScript 中,class 的方法默认不会[ 绑定] ( https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind ) ` this ` 。如果你忘记绑定 ` this.handleClick ` 并把它传入了 ` onClick ` ,当你调用这个函数的时候 ` this ` 的值为 ` undefined ` 。
97
97
@@ -151,4 +151,4 @@ class LoggingButton extends React.Component {
151
151
152
152
上述两种方式是等价的,分别通过[ 箭头函数] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions ) 和 [ ` Function.prototype.bind ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind ) 来实现。
153
153
154
- 在这两种情况下,参数 ` e ` 会作为 React 的事件对象被作为第二个参数传递。通过箭头函数的方式,事件对象必须显式的进行传递,但是通过 ` bind ` 的方式,事件对象以及更多的参数将会被隐式的进行传递。
154
+ 在这两种情况下,参数 ` e ` 会作为 React 的事件对象被作为第二个参数传递。通过箭头函数的方式,事件对象必须显式的进行传递,但是通过 ` bind ` 的方式,事件对象以及更多的参数将会被隐式的进行传递。
You can’t perform that action at this time.
0 commit comments