S
S
sinevik2018-02-25 17:08:44
React
sinevik, 2018-02-25 17:08:44

How to create a number of paragraphs in a loop and store them in a variable?

let result = for(var i = 0; i < 5; i++){
      <p style={}>
        Привет
      </p>
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-02-25
@sinevik

const result = [...Array(5)].map(() => <p>hello, world!!</p>);

https://jsfiddle.net/kng72um9/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question