Use const instead of var (#8107)

It clarifies that `history` and `current` won't be reassigned.
This commit is contained in:
Lutz Rosema
2016-10-26 16:20:09 +02:00
committed by Dan Abramov
parent d5eff3b0eb
commit 42465eefed

View File

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