I have a fixed array(9) and I want to update the value of the array, this works perfectly but I want to optimize the code:
constructor (props) {
super();
this.state ={
token: "X",
val: ["","","","","","","","",""]
};
}
intelligentComputerPlay () {
this.setState({
val: [
this.state.token,
this.state.val[1],
this.state.val[2],
this.state.val[3],
this.state.val[4],
this.state.val[5],
this.state.val[6],
this.state.val[7],
this.state.val[8]
];
});