Skip to content

sort Feeds

Ray edited this page Jan 14, 2025 · 1 revision

newest at the top

postsArray.sort((a, b) =>
				(a.post.record as { createdAt: string }).createdAt >
				(b.post.record as { createdAt: string }).createdAt
					? -1
					: 1,
			);

oldest at the top

postsArray.sort((a, b) =>
				(a.post.record as { createdAt: string }).createdAt <
				(b.post.record as { createdAt: string }).createdAt
					? -1
					: 1,
			);

Clone this wiki locally