Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const [data, setData] = useState(dataArr);
- const fnMostRecent = () => {
- let arr2 = [];
- const data2 = Object.assign(arr2, data);
- setData(data2.sort((a, b) => new Date(b.date) - new Date(a.date)));
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement