chore: better examples

This commit is contained in:
endiliey 2018-08-26 03:11:28 +08:00
parent d3e12c9455
commit be3d259ac8
18 changed files with 619 additions and 174 deletions

View file

@ -0,0 +1,36 @@
import React from 'react';
import Square from './square';
import styles from './styles.css';
export default class Board extends React.Component {
renderSquare(i) {
return (
<Square
value={this.props.squares[i]}
onClick={() => this.props.onClick(i)}
/>
);
}
render() {
return (
<div>
<div className={styles.boardRow}>
{this.renderSquare(0)}
{this.renderSquare(1)}
{this.renderSquare(2)}
</div>
<div className={styles.boardRow}>
{this.renderSquare(3)}
{this.renderSquare(4)}
{this.renderSquare(5)}
</div>
<div className={styles.boardRow}>
{this.renderSquare(6)}
{this.renderSquare(7)}
{this.renderSquare(8)}
</div>
</div>
);
}
}