The Idea is to do something like this. Create a helper function to restructure the data into a multidimensional array by grouping them so that each array in the multidimensional array holds records about courses with the same id. then loop through the multidimensional array and perform whatever logic you want to.

let courses=[{id:1, SUBJECT: "ACC", NO:121,DESCR: 'class description1'}, 
         {id:2, SUBJECT:"ACC", NO:121, DESCR:'class description2'},

//Where ever we want to print the first group we just need to call the CourseList with a single input from the multidimentional structured array asonst 

CourseList=(courses, onCourseSelect)=>{
//create another variable to hold the structured data
//this ensures that each key in the array is it self another array holding all the courses with that same id.
let structuredData = new Array(); =>  structuredData[] = (courses.filter(co =>( == ))))
  <div className="List ui relaxed divided list">, k) => {
      //each iteration over data is printing for a single group
      console.log("Group", k)>
        <CourseItem key={} descr={course.DESCR} onCourseSelect={onCourseSelect}  />

Related Query

More Query from same tag