As we saw in this higher order function map example, transforming arrays into lists of elements works in similar way in React.
Let’s try to use the same array in React.
To do so, we need to loop through the array using the map() function. Inside map function we’ll make use of JSX. We return an element for each array item and assign the returning array of elements to a variable.
Finally, to render the elements to the DOM, we just need to include the variable inside a list tag.
If you want an ordered list, just change the list tag from ul to ol.
It doesn’t have to be a list tag, you can just use div and p tags to create a list with a help from CSS Counters.
Here are some more reads for you:
How to render lists inside a component in React?
What are keys in React?