T
T
testtoster2020-02-03 10:05:40
JavaScript
testtoster, 2020-02-03 10:05:40

How to loop numbers in React?

Print the numbers from 1 to 100 on the page

I created state. Then I created a function and output state. Where did I go wrong and is the procedure correct? Thanks everyone for the replies

this.state = {
      number: this.number,
    };

  number() {
    for (let i = 0; i >= 100; i++) {
      console.log(i);
    }
  }

        {this.state.number.map(elem => <p>{elem}</p>)}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question