Skip to content

Commit 8773885

Browse files
committed
introducing state into game component
Signed-off-by: Tathagat Thapliyal <[email protected]>
1 parent a3a76d9 commit 8773885

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/components/Game.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
import React from 'react'
22
import Board from './Board'
33

4-
export default function Game() {
5-
return(
6-
<div className= "game">
7-
<div className = "game-board">
8-
<Board/>
4+
export default class Game extends React.Component {
5+
constructor() {
6+
super()
7+
this.state = {
8+
xIsNext: true,
9+
stepNumber: 0,
10+
history: [
11+
{squares: Array(9).fill(null)}
12+
]
13+
}
14+
}
15+
render() {
16+
return(
17+
<div className= "game">
18+
<div className = "game-board">
19+
<Board/>
20+
</div>
921
</div>
10-
</div>
11-
)
22+
)
23+
}
1224
}

0 commit comments

Comments
 (0)