Constructor
new Board(props)
Board constructor.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object | component input.
Properties
|
- Source:
- See:
Extends
Methods
render() → {React.JSX.Element}
Renders the 9 squares of the board.
- Source:
- See:
Returns:
a <div> tag with a 3 × 3 grid layout, with 3
buttons per row, each of which with value 'X', 'O' or null.
- Type
- React.JSX.Element
renderSquare(i) → {React.JSX.Element}
We'll pass down a prop, from the Board to the Square,
with a value and function, and we'll have Square call
that function when a square is clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
i |
Number | square index ∈ [0..8]. |
- Source:
Returns:
the i-th square with its value and click callback.
- Type
- React.JSX.Element