Browse Source

Add explanation of step and move variables (#3823)

main
Afiq Nazrie 3 years ago
committed by GitHub
parent
commit
284c2544f1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/tutorial/tutorial.md

2
content/tutorial/tutorial.md

@ -1045,6 +1045,8 @@ Let's `map` over the `history` in the Game's `render` method:
**[View the full code at this point](https://codepen.io/gaearon/pen/EmmGEa?editors=0010)**
As we iterate through `history` array, `step` variable refers to the current `history` element value, and `move` refers to the current `history` element index. We only interested in `move` here, hence `step` is not getting assigned to anything.
For each move in the tic-tac-toe game's history, we create a list item `<li>` which contains a button `<button>`. The button has a `onClick` handler which calls a method called `this.jumpTo()`. We haven't implemented the `jumpTo()` method yet. For now, we should see a list of the moves that have occurred in the game and a warning in the developer tools console that says:
> Warning:

Loading…
Cancel
Save