show recent posts on top

This commit is contained in:
Kim, Jimin 2022-01-18 12:30:27 +09:00
parent b977e3f9ec
commit b8d5ede31a

View file

@ -36,11 +36,11 @@ const PostList = (props: Props) => {
const [postsLength, setPostsLength] = useState(0)
const [postCards, setPostCards] = useState<JSX.Element[]>([])
const loadPostCards = () => {
function loadPostCards() {
let postCount = 0
const postCards = [] as JSX.Element[]
for (const date in map.date) {
for (const date of Object.keys(map.date).reverse()) {
if (postCount >= howMany) break
const length = map.date[date].length