1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

Add keys to iterators

This commit is contained in:
Daniel Barber 2016-12-07 23:24:27 +00:00
parent bf38a9b86c
commit dab37155e4

View File

@ -10,10 +10,12 @@ class ChessBoard extends React.Component {
this.state = defaultState; this.state = defaultState;
} }
chessBoardRow(row) { chessBoardRow(row, i) {
return ( return (
<div className="board-row"> <div className="board-row" key={i}>
{row.map((square) => <ChessBoardSquare square={square} />)} {row.map(
(square, j) => <ChessBoardSquare key={j} square={square} />
)}
</div> </div>
) )
} }
@ -21,7 +23,7 @@ class ChessBoard extends React.Component {
render() { render() {
return ( return (
<div className="board"> <div className="board">
{this.state.board.map((row) => this.chessBoardRow(row))} {this.state.board.map((row, i) => this.chessBoardRow(row, i))}
</div> </div>
); );
} }