We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1c64d3 commit 2cde775Copy full SHA for 2cde775
src/index.js
@@ -25,7 +25,13 @@ class Board extends React.Component {
25
};
26
}
27
28
- renderSquare(i) {
+ handleClick(i) {
29
+ const squares = this.state.squares.slice(); // Shallow copy
30
+ squares[i] = 'X'; // (*)... Then this number will be used to update only the specific Square.
31
+ this.setState({squares: squares});
32
+ }
33
+
34
+ renderSquare(i) { // When we create a Square we assign a numer to it ...(*)
35
return (
36
<Square
37
value={this.state.squares[i]} // Set the 'this.props.value' of the Square Component to 'X', 'O' or Null.
0 commit comments