Browse Source

Use `const` instead of `var` (#8107)

It clarifies that `history` and `current` won't be reassigned.
main
Lutz Rosema 8 years ago
committed by Dan Abramov
parent
commit
0ab8a03e93
  1. 4
      tutorial/tutorial.md

4
tutorial/tutorial.md

@ -386,8 +386,8 @@ Its `handleClick` can push a new entry onto the stack by concatenating the new h
```javascript ```javascript
handleClick(i) { handleClick(i) {
var history = this.state.history; const history = this.state.history;
var current = history[history.length - 1]; const current = history[history.length - 1];
const squares = current.squares.slice(); const squares = current.squares.slice();
if (calculateWinner(squares) || squares[i]) { if (calculateWinner(squares) || squares[i]) {
return; return;

Loading…
Cancel
Save