🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` class Board extends React.Component { Square(i){ return <Square value="i"/> } render(){ const status = "Next player: X"; return ( <div> <div className="status">{status}</div> <div className="board-row"> {this.Square(0)} {this.Square(1)} {this.Square(2)} </div> <div className="board-row"> {this.Square(3)} {this.Square(4)} {this.Square(5)} </div> <div className="board-row"> {this.Square(6)} {this.Square(7)} {this.Square(8)} </div> </div> ) } } ``` ``` class Board extends React.Component { Square(i){ return <Square value="{i}"/> } render(){ const status = "Next player: X"; return ( <div> <div className="status">{status}</div> <div className="board-row"> {this.Square(0)} {this.Square(1)} {this.Square(2)} </div> <div className="board-row"> {this.Square(3)} {this.Square(4)} {this.Square(5)} </div> <div className="board-row"> {this.Square(6)} {this.Square(7)} {this.Square(8)} </div> </div> ) } } ``` ``` Square(i){ return <Square value={i}/> } ```