diff options
Diffstat (limited to 'web/src/pages/list.js')
-rw-r--r-- | web/src/pages/list.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/web/src/pages/list.js b/web/src/pages/list.js new file mode 100644 index 0000000..a806622 --- /dev/null +++ b/web/src/pages/list.js @@ -0,0 +1,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> + [{e.count}] + </header> + {e.description} + </article> + )); +}; + +export default List; |