Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question