I take threads from the backend endpoint
type Thread = {
threadId: string,
title: string;
author: string;
lastReply: string;
replyTime: string;
creationTime: string;
}
const HomePage: React.FC = () => {
const loggedIn = authHeader();
const classes = useStyles();
const {
threads,
categories,
} = useMainData();
return (
<>
...
...
I want to sort threads by creationTime and pass it to the component in that order. Or maybe it's better to pass just threads and sort it into the component? I was thinking about sth like this:
const Categories: React.FC<ThreadsListProps> = (props) => {
const {
latestthreads
} = props;
const sortedthreads = latestthreads.sort((a, b) => b.creationTime - a.creationTime);
const classes = useStyles();
return (...
but time creation is string