{this.renderSquare(0, colors[0])}
{this.renderSquare(1, colors[1])}
{this.renderSquare(2, colors[2])}
{this.renderSquare(3, colors[3])}
{this.renderSquare(4, colors[4])}
{this.renderSquare(5, colors[5])}
{this.renderSquare(6, colors[6])}
{this.renderSquare(7, colors[7])}
{this.renderSquare(8, colors[8])}
{this.renderSquare(9, colors[9])}
);
}
}
class Game extends React.Component {
constructor(props) {
super(props);
this.state = {
redjar: ['red','red', 'red', 'red', 'red','red', 'red','blue', 'blue', 'blue'],
bluejar: ['blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'red', 'red', 'red']
}
}
render() {
const rand1 = this.props.jar
var jar = [];
if(rand1 == 'True'){
jar = this.state.bluejar
}
if(rand1 == 'False'){
jar = this.state.redjar
}
var colors = [];
var i = 0;
while(i < 10){
const rand2 = Math.floor(Math.random()*(jar.length-1));
var color = jar[rand2]
colors[i] = color
jar.splice(rand2, 1);
if(rand1 == 'True'){
this.state.bluejar = jar
}
if(rand1 == 'False'){
this.state.redjar = jar
}
i = i+1;
}
return (