File tree 3 files changed +16
-10
lines changed
3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import Square from './Square'
3
3
4
- export default function Board ( ) {
4
+ export default function Board ( props ) {
5
5
return (
6
6
< div >
7
7
< div className = "border-row" >
8
- < Square />
8
+ < Square insideValue = { props . value } />
9
9
< Square />
10
10
< Square />
11
11
</ div >
Original file line number Diff line number Diff line change @@ -2,21 +2,27 @@ import React from 'react'
2
2
import Board from './Board'
3
3
4
4
export default class Game extends React . Component {
5
- constructor ( ) {
6
- super ( )
5
+ constructor ( props ) {
6
+ super ( props )
7
7
this . state = {
8
8
xIsNext : true ,
9
9
stepNumber : 0 ,
10
10
history : [
11
11
{ squares : Array ( 9 ) . fill ( null ) }
12
- ]
13
- }
14
- }
12
+ ] ,
13
+ }
14
+ }
15
+
16
+ someFunction = ( ) => {
17
+ return 5
18
+ }
19
+
15
20
render ( ) {
21
+ const result = this . someFunction ( )
16
22
return (
17
23
< div className = "game" >
18
24
< div className = "game-board" >
19
- < Board />
25
+ < Board value = { result } />
20
26
</ div >
21
27
</ div >
22
28
)
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
3
- export default function Square ( ) {
3
+ export default function Square ( props ) {
4
4
return (
5
5
< button className = "square" >
6
-
6
+ { props . insideValue }
7
7
</ button >
8
8
)
9
9
}
You can’t perform that action at this time.
0 commit comments