summaryrefslogtreecommitdiff
path: root/web/src/pages/list.js
blob: a806622f0f13eba757418425703a3264c7c2aceb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import React from "react";
import { useLoaderData } from "react-router";
import { Link } from "react-router-dom";

const List = () => {
    const list = useLoaderData();

    return list
        .sort((e1, e2) => e2.count - e1.count)
        .map((e) => (
            <article key={e.name}>
                <header>
                    <Link to={`/e/${e.name}`}>{e.name}</Link>
                    &nbsp; [{e.count}]
                </header>
                {e.description}
            </article>
        ));
};

export default List;