How to repeat an element n times using JSX?

Posted by Rohit Kumar | Updated on

Want to repeat an element n times using JSX in your ReactJS application? Use the below example:

You may want to add key to each span element so React won’t complain about missing the key attribute:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers