I have a bunch of objects inside an array and I have to check status of each object and return a single value for each array.
(10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {projId: 1, task: 'task 1', status: 'completed'}
1: {projId: 1, task: 'task 2', status: 'completed'}
2: {projId: 1, task: 'task 3', status: 'completed'}
3: {projId: 1, task: 'task 4', status: 'completed'}
4: {projId: 1, task: 'task 5', status: 'completed'}
5: {projId: 1, task: 'task 6', status: 'completed'}
6: {projId: 1, task: 'task 7', status: 'completed'}
7: {projId: 1, task: 'task 8', status: 'completed'}
8: {projId: 1, task: 'task 9', status: 'completed'}
9: {projId: 1, task: 'task 10', status: 'completed'}
Need to check the status, and if it is completed for the whole array then return competed else return in progress. The code I tried is given below, but that returns for each object in array.
{GroupedData[key].map(status => ((status.status === "completed")? "Completed" : "In Progress"))}
And I am writing this inside the return of export function in React.js