sarah sarah - 1 month ago 9
React JSX Question

How to create an ordered numbered list in react

I need to create an ordered list in react and I am doing following in the render()

render() {
<div key ={category.index}>
question.map(questionlist =>
<li key={questionlist.key}>{questionlist.description}</li>)}
</div>

Answer

Use an ordered list to get the numbering

render() {
  <ol>
     { question.map(questionlist =>
       <li key={questionlist.key}>{questionlist.description}</li>)}}
  </ol>
}