score:0

const randFloorNumber = Date.now();

score:0

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      amount: 7,
      randoms: []
    };

  }

  componentDidMount() {
      this.handleClick();
  }

  handleClick = () => {
    const min = 0;
    const max = 9;
    const randoms = []; 

    for (let i = 0; i < this.state.amount; i++) {
        const randFloorNumber = Math.floor(min + Math.random() * (max - min));
        randoms.push(randFloorNumber);
    }
        this.setState({randoms})
  }

  render() {
    const randoms = this.state.randoms.map(random => {
        return (
        <div key={idx} className="App-number-div col border border-info">
            {random}
        </div>
        )
    })

    return (
      <div className="App">
        <img src={logo} alt="Logo" onClick={this.handleClick} />
        <div className="container">{randoms}</div>
      </div>
    );
  }
}

Related Query

More Query from same tag