in my app, I have a map of an array that returns a div with a data-date attribute like so:
Note I cannot sort the array here as I don't have any dates to compare them with, only the ID of the element
const mappedArray = array.map(el=>{
return (
<DivComponent el={el} />
)
})
Inside the DivComponent, I make a fetch to firebase where I get the info of each div along with a timestamp
const DivComponent = (props) => {
const info = useGetInfo(props.el.id)
return (
<div data-data={info.date.toDate()}>Some content</div>
)
}
Given these conditions, is it possible to sort the array above given that each children have an assigned date ?