@@ -22,6 +22,10 @@ export default class GameBoard extends Component {
22
22
} ) ;
23
23
}
24
24
25
+ handleBackToGameList ( ) {
26
+ this . props . backToGameListHandler ( ) ;
27
+ }
28
+
25
29
renderCell ( row , col ) {
26
30
let value = this . props . game . board [ row ] [ col ] ;
27
31
if ( value === 0 ) return ( < td > O</ td > ) ;
@@ -32,25 +36,28 @@ export default class GameBoard extends Component {
32
36
}
33
37
render ( ) {
34
38
return (
35
- < table className = "game-board" >
36
- < tbody >
37
- < tr >
38
- { this . renderCell ( 0 , 0 ) }
39
- { this . renderCell ( 0 , 1 ) }
40
- { this . renderCell ( 0 , 2 ) }
41
- </ tr >
42
- < tr >
43
- { this . renderCell ( 1 , 0 ) }
44
- { this . renderCell ( 1 , 1 ) }
45
- { this . renderCell ( 1 , 2 ) }
46
- </ tr >
47
- < tr >
48
- { this . renderCell ( 2 , 0 ) }
49
- { this . renderCell ( 2 , 1 ) }
50
- { this . renderCell ( 2 , 2 ) }
51
- </ tr >
52
- </ tbody >
53
- </ table >
39
+ < div >
40
+ < button onClick = { this . handleBackToGameList . bind ( this ) } > Back</ button >
41
+ < table className = "game-board" >
42
+ < tbody >
43
+ < tr >
44
+ { this . renderCell ( 0 , 0 ) }
45
+ { this . renderCell ( 0 , 1 ) }
46
+ { this . renderCell ( 0 , 2 ) }
47
+ </ tr >
48
+ < tr >
49
+ { this . renderCell ( 1 , 0 ) }
50
+ { this . renderCell ( 1 , 1 ) }
51
+ { this . renderCell ( 1 , 2 ) }
52
+ </ tr >
53
+ < tr >
54
+ { this . renderCell ( 2 , 0 ) }
55
+ { this . renderCell ( 2 , 1 ) }
56
+ { this . renderCell ( 2 , 2 ) }
57
+ </ tr >
58
+ </ tbody >
59
+ </ table >
60
+ </ div >
54
61
)
55
62
}
56
63
}
0 commit comments