From 0e6e896851b0034abbc1b073cbc500ca48f59da4 Mon Sep 17 00:00:00 2001 From: djmil Date: Fri, 24 Nov 2023 13:10:39 +0100 Subject: [PATCH] small code explainer --- webapp/src/components/Checkers.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/src/components/Checkers.jsx b/webapp/src/components/Checkers.jsx index c9447c6..a6f2f77 100644 --- a/webapp/src/components/Checkers.jsx +++ b/webapp/src/components/Checkers.jsx @@ -85,7 +85,10 @@ export function Board({ board, flip, prevMove, currMove, onStoneClick, onStoneMo const isInteractive = (board && (typeof onStoneClick === 'function' || typeof onStoneMove === 'function')) ? ' interactive' : ''; const WhiteTile = ({ id }) => { - const stone = (id === currMove[1]) ? board[currMove[0]] : board[id]; + id = (id !== currMove[1]) ? id : + currMove[0]; // the stone from currMove sarting position + + const stone = board[id]; return (