MUI Datagrid display array of objects

Viewed 557

I am using Redux to fetch data from my API and this is what my data looks like:

enter image description here

The problem I am facing is a way to display the data from the array of objects named question.

I am using render Cell to render data for rows currently, here is the snippet of that:

return {
      field: item.dbCol, // I've a config file, which reads field name from a loop
      type: item.fieldType,
      width: item.columnWidth,
      renderCell: (params) => {
        return item.elements.map((element, iterator)=>{
          switch (element.columnType) {
             case 'Question':
              return params.row.question.map((item)=><p>{item.answer}</p>);
}

This is what I've tried so far, but I'm not able to get the data from the question object with the right column!

Any help will be really appreciated.

0 Answers
Related