Create a Chess game with Reactjs part 28: King danger

Опубликовано: 18 Май 2026
на канале: Frontend Coding
1,089
22

Preventing the king from moving into danger and fixing a bug that prevents us from promoting pieces is what we are going to talk about and implement in this episode of creating a chess game with React using TypeScript.

The code in this video can be found on the Frontend Coding GitHub repository:
https://github.com/FrontendCodingYT/c...

Timestamps:
0:00 Welcome! Short introduction.
0:55 Coding! Backtracking the problem.
2:28 Coding! Implementing setBoard function.
5:48 Coding! Fixing the promotionPiece position.
10:28 Explaining! Why is the pawn not updating?
13:25 Coding! Fixing the problem.
16:24 Coding! Adding the possibleMoves back in.
17:44 Explaining! When is the king in danger?
19:25 Coding! Implementing the king danger detector.
26:50 Coding! Adding the pawn logic.
32:45 Coding! Simulating a future board state.
37:25 Coding! Updating the positions of the pieces.
40:07 Explaining! Walking through the code.
46:15 Coding! New way of determining valid moves.
48:25 Coding! Fixing the instant promotion bug.
48:52 Thank you for watching! See you next time :)