Skip to content

Commit 7cf3cc1

Browse files
authored
Update tutorial.md (#4461)
1 parent c0b6e0b commit 7cf3cc1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/tutorial/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,13 +1148,13 @@ Next, we'll define the `jumpTo` method in Game to update that `stepNumber`. We a
11481148
}
11491149
```
11501150

1151-
Notice in `jumpTo` method, we haven't updated `history` property of the state. That is because state updates are merged or in more simple words React will update only the properties mentioned in `setState` method leaving the remaining state as that is. For more info **[see the documentation](/docs/state-and-lifecycle.html#state-updates-are-merged)**.
1151+
Notice in `jumpTo` method, we haven't updated `history` property of the state. That is because state updates are merged or in more simple words React will update only the properties mentioned in `setState` method leaving the remaining state as is. For more info **[see the documentation](/docs/state-and-lifecycle.html#state-updates-are-merged)**.
11521152

11531153
We will now make a few changes to the Game's `handleClick` method which fires when you click on a square.
11541154

11551155
The `stepNumber` state we've added reflects the move displayed to the user now. After we make a new move, we need to update `stepNumber` by adding `stepNumber: history.length` as part of the `this.setState` argument. This ensures we don't get stuck showing the same move after a new one has been made.
11561156

1157-
We will also replace reading `this.state.history` with `this.state.history.slice(0, this.state.stepNumber + 1)`. This ensures that if we "go back in time" and then make a new move from that point, we throw away all the "future" history that would now become incorrect.
1157+
We will also replace reading `this.state.history` with `this.state.history.slice(0, this.state.stepNumber + 1)`. This ensures that if we "go back in time" and then make a new move from that point, we throw away all the "future" history that would now be incorrect.
11581158

11591159
```javascript{2,13}
11601160
handleClick(i) {

0 commit comments

Comments
 (0)