Skip to content

Commit 9bf8a1a

Browse files
authored
fix: code pen
1 parent b253a07 commit 9bf8a1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/docs/handling-events.md

Lines changed: 2 additions & 2 deletions
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)