mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Use const instead of var (#8107)
It clarifies that `history` and `current` won't be reassigned.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user