I have an array of Objects for a quiz like so.
[
    {
        answer: "Patience"
        question: "Name a GNR song..."
        questionId: 13
        questiontype: "text"
        userId: 1
    },
    {
        answer: "ABC"
        question: "Select three MJ songs..."
        questionId: 14
        questiontype: "checkbox"
        userId: 1
    },
    {
        answer: "Thriller"
        question: "Name three MJ songs..."
        questionId: 14
        questiontype: "checkbox"
        userId: 1
    }
]
What I am trying to do is display them on a page. So at the moment I am doing something like this
{quizData.map((item, index) => {
  return (
    <div key={index}>
      <Col xs={12}>
        <p className="text-start quiz-text">
          <strong>
            Question {item.question}
          </strong>
        </p>
      </Col>
      <Col xs={12}>
        <p className="text-start argent c-font quiz-text">{item.answer}</p>
      </Col>
    </div>
  );
})}
The problem is that this will display a new question row for each answer. So for the data above, I see something like this
Name a GNR song
    Patience
Select 3 MJ songs
    ABC
    
Select 3 MJ songs
    Thriller
What I am trying to do is have only one question, but if that question has multiple answers, display these as part of that question. So the above would be something like
Name a GNR song
    Patience
Select 3 MJ songs
    ABC
    Thriller
I presume I have to match the questionId somehow, but not sure how I can achieve this within my map?
Any advice appreciated.
Thanks
 
     
     
     
     
    