Skip to content

Commit 0dd75af

Browse files
committed
Merge branch 'translate-Handling-Events' of https://github.com/Ryanhui/zh-hans.reactjs.org into translate-Handling-Events
2 parents cadaec8 + 9bf8a1a commit 0dd75af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/docs/handling-events.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ReactDOM.render(
9191
);
9292
```
9393

94-
[**在 CodePen 上尝试**](http://codepen.io/gaearon/pen/xEmzGg?editors=0010)
94+
[**在 CodePen 上尝试**](https://codepen.io/gaearon/pen/xEmzGg?editors=0010)
9595

9696
你必须谨慎对待 JSX 回调函数中的 `this`,在 JavaScript 中,class 的方法默认不会[绑定](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind) `this`。如果你忘记绑定 `this.handleClick` 并把它传入了 `onClick`,当你调用这个函数的时候 `this` 的值为 `undefined`
9797

@@ -151,4 +151,4 @@ class LoggingButton extends React.Component {
151151

152152
上述两种方式是等价的,分别通过[箭头函数](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) 来实现。
153153

154-
在这两种情况下,参数 `e` 会作为 React 的事件对象被作为第二个参数传递。通过箭头函数的方式,事件对象必须显式的进行传递,但是通过 `bind` 的方式,事件对象以及更多的参数将会被隐式的进行传递。
154+
在这两种情况下,参数 `e` 会作为 React 的事件对象被作为第二个参数传递。通过箭头函数的方式,事件对象必须显式的进行传递,但是通过 `bind` 的方式,事件对象以及更多的参数将会被隐式的进行传递。

0 commit comments

Comments
 (0)