score:5

Accepted answer
class ComponentThree extends React.Component {
  render() {
    return <div>ComponentThree</div>;
  }
}

class ComponentTwo extends React.Component {
  render() {
    return <div>ComponentTwo</div>;
  }
}

class ComponentOne extends React.Component {
  render() {
    return <div>ComponentOne</div>;
  }
}

class Hello extends React.Component {
randomize(myArray) {
    return myArray[Math.floor(Math.random() * myArray.length)];
}
  render() {
    var arr = [<ComponentOne />, <ComponentTwo />, <ComponentThree />]
    return <div>Hello {this.randomize(arr)}</div>;
  }
}

Related Query

More Query from same tag