var currStatus = '';
var job = [...this.state.data];
return <div>
{
job.length ?
<div>
{
Object.keys(job).forEach(jobTree) => {
job[jobTree].sortBy((leftItem, rightItem) => {
return leftItem.job.Title.localeCompare(rightItem.job.Title)
});
<div><h2>{jobTree}</h2></div>
this.state.data[jobTree].forEach((row) => {
if(currStatus != row.status.Title) {
currStatus = row.status.Title;
<div> <h3>{currStatus}</h3></div>
}
});
})
I used sort()
to sort job alphabetically.
But I am getting an error:
Uncaught (in promise) TypeError: Job[jobTree].sort is not a function