I need cool red seconds cells in red. But i got blue, what have I done wrong?
I have a function, that check prevent cell, and mark cell.
AI_CELL = RED color
HIGHLIGHT_CELL = BLUE color
USER_CELL = GREEN color
const checkWinnerScore = () => {
let [y, x] = prevCell;
let copyCells = JSON.parse(JSON.stringify(cells));
if (copyCells[y][x] === HIGHLIGHT_CELL) {
// I assign value, but cell do not coolerd in red.
copyCells[y][x] = AI_CELL;
setCells(copyCells);
setAiScore(aiScore + 1);
} else if (copyCells[y][x] === AI_CELL) {
return;
}
};
Full example in codesandbox: https://codesandbox.io/s/vigilant-gates-zfcmm?file=/src/components/Cells.js:2098-2430