🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` class Board extends React.Component { constructor(){ super(); this.state = { squares: Array(9).fill(0), history:[] } } handleClick(i){ //console.log(i); const squares = this.state.squares.slice() //history.push(squares) //console.log(squares); squares[i]="X" this.setState({ squares:squares, history:this.state.history.concat([{ squares:squares }]) }) console.log(this.state.history) } ```