I was just trying to see how I can sort the items from newest to oldest in an object based on the dateModified
prop.
I have tried doing the good old fashion way of sorting, however, the items still render in the same order no matter what. Is there any other way to do so other than this way?
Object:
Code:
const filteredAndSortedBotConfigs = Object.keys(botConfigs)
.sort((a, b) => new Date(b.modifiedTimestamp) - new Date(a.modifiedTimestamp))
.filter(this.filterConfigsByBot)
.filter(
(key) =>
botConfigs[key].status === "RUNNING" && botConfigs[key].mode !== null
);