From f44e7e5f69e19ceb1909f371eb88e44e736990ee Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 21 Jun 2020 09:16:29 -0700 Subject: [PATCH] Rename local variable from "active" to "grid_active" There is an "active" property up and down our component stack, (at the board level, whether it's the current players turn; further at the mini-grid level, whether it's a legal mini-grid; further still at the square level, whether the square is unoccupied). It's clear enough to uses a props name of "active" at each level. But when using a local variable to compute the child's "active" prop while in a current component with its own "active" prop, this can get confusing. So, at the board level, use a local variable of "grid_active" to compute the "active" prop for the child grid. --- scribe/scribe.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scribe/scribe.jsx b/scribe/scribe.jsx index 2cc5148..d66fc04 100644 --- a/scribe/scribe.jsx +++ b/scribe/scribe.jsx @@ -402,9 +402,9 @@ class Board extends React.Component { * b. This mini grid corresponds to this players last turn * c. The mini grid that corresponds to the players last turn is full */ - let active = false; + let grid_active = false; if (this.props.active) { - active = true; + grid_active = true; if (this.props.last_two_moves.length > 1) { /* First index (0) gives us our last move, (that is, of the * last two moves, it's the first one, so two moves ago). @@ -422,7 +422,7 @@ class Board extends React.Component { /* If the target mini-grid isn't full then this grid is * only active if it is that target. */ if (occupied < 9) - active = (i === target); + grid_active = (i === target); } } @@ -438,7 +438,7 @@ class Board extends React.Component { return ( this.props.onClick(i,j)} /> -- 2.43.0