You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/tutorial/tutorial.md
-8Lines changed: 0 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -451,19 +451,11 @@ class Square extends React.Component {
451
451
452
452
Khi một Square được bấm, hàm `onClick` cung cấp bởi Board sẽ được gọi. Dưới đây là tổng kết lại những gì ta đã đạt được đến thời điểm này:
453
453
454
-
<<<<<<< HEAD
455
454
1. Prop `onClick` trong DOM có sẵn `button` component cho phép React lắng nghe sự kiện nhấp chuột.
456
455
2. Khi button được bấm, React sẽ gọi hàm `onClick` được định nghĩa trong phương thức `render` của Square component.
457
456
3. Hàm xử lý sự kiện này sẽ gọi hàm `this.props.onClick()`. Prop `onClick` của Square component được chỉ định bởi Board component.
458
457
4. Khi Board componet truyền prop `onClick={() => this.handleClick(i)}` xuống Square component, Square sẽ gọi hàm `this.handleClick(i)` khi nó được bấm.
459
458
5. Chúng ta chưa hề định nghĩa phương thức `handleClick()` vì vậy code của chúng ta sẽ không chạy được ở thời điểm hiện tại. Khi bấm vào một Square, bạn sẽ thấy lỗi được trả ra trên màn hình dạng như "this.handleClick is not a function".
460
-
=======
461
-
1. The `onClick` prop on the built-in DOM `<button>` component tells React to set up a click event listener.
462
-
2. When the button is clicked, React will call the `onClick` event handler that is defined in Square's `render()` method.
463
-
3. This event handler calls `this.props.onClick()`. The Square's `onClick` prop was specified by the Board.
464
-
4. Since the Board passed `onClick={() => this.handleClick(i)}` to Square, the Square calls the Board's `handleClick(i)` when clicked.
465
-
5. We have not defined the `handleClick()` method yet, so our code crashes. If you click a square now, you should see a red error screen saying something like "this.handleClick is not a function".
0 commit comments